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