Skip to content
Permalink
Browse files

add new example + update changelog

  • Loading branch information
spipu committed Mar 22, 2020
1 parent 68aa9aa commit 42836b8d6c19a0fb4b2e604f17d8708b7a7409b6
Showing with 65 additions and 0 deletions.
  1. +1 −0 CHANGELOG.md
  2. +31 −0 examples/example15.php
  3. +23 −0 examples/res/example15.php
  4. +10 −0 src/Tests/ExamplesTest.php
@@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.

## [5.2.2](https://github.com/spipu/html2pdf/compare/v5.2.1...master) - unreleased

* allow usage of [[page_cu]] in css class names - thanks to @marbetschar - see example 15
* add support for BASE64 encoded images - thanks to @darius-heavy
* add Chinese local file - thanks to @Jaggle
* add powershell test script
@@ -0,0 +1,31 @@
<?php
/**
* Html2Pdf Library - example
*
* HTML => PDF converter
* distributed under the OSL-3.0 License
*
* @package Html2pdf
* @author Laurent MINGUET <webmaster@html2pdf.fr>
* @copyright 2017 Laurent MINGUET
*/
require_once dirname(__FILE__).'/../vendor/autoload.php';

use Spipu\Html2Pdf\Html2Pdf;
use Spipu\Html2Pdf\Exception\Html2PdfException;
use Spipu\Html2Pdf\Exception\ExceptionFormatter;

try {
ob_start();
include dirname(__FILE__).'/res/example15.php';
$content = ob_get_clean();

$html2pdf = new Html2Pdf('P', 'A4', 'fr');
$html2pdf->writeHTML($content);
$html2pdf->output('example15.pdf');
} catch (Html2PdfException $e) {
$html2pdf->clean();

$formatter = new ExceptionFormatter($e);
echo $formatter->getHtmlMessage();
}
@@ -0,0 +1,23 @@
<style type="text/css">
<!--
div {
border: solid 2mm red;
}
div.content-1 {
background: green;
}
div.content-2 {
background: blue;
}
-->
</style>
<page>
<div class="content-[[page_cu]]">Page [[page_cu]]</div>
</page>
<page>
<div class="content-[[page_cu]]">Page [[page_cu]]</div>
</page>
@@ -222,6 +222,16 @@ public function testExample14()
$this->launchExample('example14');
}

/**
* test: example15
*
* @return void
*/
public function testExample15()
{
$this->launchExample('example15');
}

/**
* test: forms
*

0 comments on commit 42836b8

Please sign in to comment.
You can’t perform that action at this time.