upgrade to dompdf/dompdf 0.8.*
This commit is contained in:
parent
b72ffbdc98
commit
41a048604e
|
|
@ -20,7 +20,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Franck Lefevre",
|
"name": "Franck Lefevre",
|
||||||
"homepage": "http://blog.rootslabs.net"
|
"homepage": "https://rootslabs.net/blog/"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Ivan Lanin",
|
"name": "Ivan Lanin",
|
||||||
|
|
@ -34,10 +34,9 @@
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=5.3.3",
|
"php": ">=5.3.3",
|
||||||
"ext-xml": "*",
|
"ext-xml": "*",
|
||||||
"zendframework/zend-escaper": "2.4.*",
|
"zendframework/zend-escaper": "^2.2",
|
||||||
"zendframework/zend-stdlib": "2.4.*",
|
"zendframework/zend-stdlib": "^2.2",
|
||||||
"zendframework/zend-validator": "2.4.*",
|
"phpoffice/common": "^0.2"
|
||||||
"phpoffice/common": "0.2.*"
|
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "3.7.*",
|
"phpunit/phpunit": "3.7.*",
|
||||||
|
|
@ -45,7 +44,7 @@
|
||||||
"squizlabs/php_codesniffer": "1.*",
|
"squizlabs/php_codesniffer": "1.*",
|
||||||
"phpmd/phpmd": "2.*",
|
"phpmd/phpmd": "2.*",
|
||||||
"phploc/phploc": "2.*",
|
"phploc/phploc": "2.*",
|
||||||
"dompdf/dompdf":"0.6.*",
|
"dompdf/dompdf":"0.8.*",
|
||||||
"tecnickcom/tcpdf": "6.*",
|
"tecnickcom/tcpdf": "6.*",
|
||||||
"mpdf/mpdf": "5.*"
|
"mpdf/mpdf": "5.*"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -83,15 +83,17 @@ abstract class AbstractRenderer extends HTML
|
||||||
public function __construct(PhpWord $phpWord)
|
public function __construct(PhpWord $phpWord)
|
||||||
{
|
{
|
||||||
parent::__construct($phpWord);
|
parent::__construct($phpWord);
|
||||||
$includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile;
|
if ($this->includeFile != null) {
|
||||||
if (file_exists($includeFile)) {
|
$includeFile = Settings::getPdfRendererPath() . '/' . $this->includeFile;
|
||||||
/** @noinspection PhpIncludeInspection Dynamic includes */
|
if (file_exists($includeFile)) {
|
||||||
require_once $includeFile;
|
/** @noinspection PhpIncludeInspection Dynamic includes */
|
||||||
} else {
|
require_once $includeFile;
|
||||||
// @codeCoverageIgnoreStart
|
} else {
|
||||||
// Can't find any test case. Uncomment when found.
|
// @codeCoverageIgnoreStart
|
||||||
throw new Exception('Unable to load PDF Rendering library');
|
// Can't find any test case. Uncomment when found.
|
||||||
// @codeCoverageIgnoreEnd
|
throw new Exception('Unable to load PDF Rendering library');
|
||||||
|
// @codeCoverageIgnoreEnd
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@
|
||||||
namespace PhpOffice\PhpWord\Writer\PDF;
|
namespace PhpOffice\PhpWord\Writer\PDF;
|
||||||
|
|
||||||
use PhpOffice\PhpWord\Writer\WriterInterface;
|
use PhpOffice\PhpWord\Writer\WriterInterface;
|
||||||
|
use Dompdf\Dompdf as DompdfLib;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DomPDF writer
|
* DomPDF writer
|
||||||
|
|
@ -32,7 +33,7 @@ class DomPDF extends AbstractRenderer implements WriterInterface
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $includeFile = 'dompdf_config.inc.php';
|
protected $includeFile = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Save PhpWord to file.
|
* Save PhpWord to file.
|
||||||
|
|
@ -49,9 +50,9 @@ class DomPDF extends AbstractRenderer implements WriterInterface
|
||||||
$orientation = 'portrait';
|
$orientation = 'portrait';
|
||||||
|
|
||||||
// Create PDF
|
// Create PDF
|
||||||
$pdf = new \DOMPDF();
|
$pdf = new DompdfLib();
|
||||||
$pdf->set_paper(strtolower($paperSize), $orientation);
|
$pdf->setPaper(strtolower($paperSize), $orientation);
|
||||||
$pdf->load_html($this->getContent());
|
$pdf->loadHtml(str_replace(PHP_EOL, '', $this->getContent()));
|
||||||
$pdf->render();
|
$pdf->render();
|
||||||
|
|
||||||
// Write to file
|
// Write to file
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue