-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
I want to convert a docx file to pdf
I put this line in bootstrap.php
define('PHPWORD_BASE_DIR', realpath(__DIR__));
And my code looks like this:
$FilePath = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".docx";
$FilePathPdf = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".pdf";
require_once APPPATH.'third_party/phpword/bootstrap.php';
$domPdfPath = realpath(PHPWORD_BASE_DIR . '/../vendor/dompdf/dompdf');
\PhpOffice\PhpWord\Settings::setPdfRendererPath($domPdfPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('DomPDF');
$phpWord = \PhpOffice\PhpWord\IOFactory::load($FilePath);
$pdfWriter = \PhpOffice\PhpWord\IOFactory::createWriter( $phpWord, 'PDF' );
$pdfWriter->save($FilePathPdf);
But i got this error:
{"status":false,"error":{"classname":"PhpOffice\\PhpWord\\Exception\\Exception","message":"PDF rendering library or library path has not been defined."}}
I read info about this topic without results: http://stackoverflow.com/questions/25563870/making-dompdf-as-my-pdf-writer-for-phpword
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
Metadata
Metadata
Assignees
Labels
No labels