Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPWord and tcpdf retrieves an empty pdf #1030

Open
50l3r opened this issue Mar 25, 2017 · 1 comment
Open

PHPWord and tcpdf retrieves an empty pdf #1030

50l3r opened this issue Mar 25, 2017 · 1 comment

Comments

@50l3r
Copy link

50l3r commented Mar 25, 2017

I execute this code to convert doc to pdf and recieve this empty pdf: LINK TO PDF

$FilePath = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".docx";
$FilePathPdf` = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".pdf";

//DOCX TO PDF
 require_once APPPATH.'third_party/phpword/bootstrap.php';

$rendererLibraryPath = PHPWORD_BASE_DIR . '/vendor/tecnickcom/tcpdf';
\PhpOffice\PhpWord\Settings::setPdfRendererPath($rendererLibraryPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('TCPDF');

$phpWord` = new \PhpOffice\PhpWord\PhpWord();

//Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load($FilePath);

//Save it
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save($FilePathPdf);

Paths are correct


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@50l3r
Copy link
Author

50l3r commented Mar 26, 2017

I try whit DOMPDF without results: LINK TO 2ND PDF

$FilePath = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".docx";
$FilePathPdf = APPPATH."media/Documentos/Facturas/Factura ".$FacturaId.".pdf";

//DOCX TO PDF
require_once APPPATH.'third_party/phpword/bootstrap.php';

$rendererLibraryPath = PHPWORD_BASE_DIR . '/vendor/dompdf/dompdf';
\PhpOffice\PhpWord\Settings::setPdfRendererPath($rendererLibraryPath);
\PhpOffice\PhpWord\Settings::setPdfRendererName('DomPDF');

$phpWord = new \PhpOffice\PhpWord\PhpWord();

//Load temp file
$phpWord = \PhpOffice\PhpWord\IOFactory::load($FilePath);

//Save it
$xmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord , 'PDF');
$xmlWriter->save($FilePathPdf,);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant