Using Phpword version 1.3.0 to generate a temporary Word file and then convert the temporary file to a PDF document results in the PDF document having a different format from the Word document, with images being enlarged. How can this be fixed? #2707
Labels
Describe the bug and add attachments
Using Phpword version 1.3.0 to generate a temporary Word file and then convert the temporary file to a PDF document results in the PDF document having a different format from the Word document, with images being enlarged. How can this be fixed?
Expected behavior
Using Phpword version 1.3.0 to generate a temporary Word file and then convert the temporary file to a PDF document results in the PDF document having a different format from the Word document, with images being enlarged. How can this be fixed?
Steps to reproduce
$tempFilePath = '../runtime/tempfile/temp_docx_file'.time("now").'.docx';
$writer = IOFactory::createWriter($phpWord, 'Word2007');
$writer->save($tempFilePath);
//转pdf
Settings::setPdfRendererPath(base_path('../vendor/tecnickcom/tcpdf'));
Settings::setPdfRendererName('TCPDF');
$wordPdf = IOFactory::load($tempFilePath);
$pdfWriter = IOFactory::createWriter($wordPdf , 'PDF');
$temp_path = '../runtime/tempfile/temp_pdf_file'.time("now").'.pdf';
//文件保存
$pdfWriter->save($temp_path);
// 读取文件内容为二进制字符串
$fileContent = file_get_contents($temp_path);
// 将二进制字符串转换为Base64编码
$base64Encoded = base64_encode($fileContent);
//unlink($tempFilePath);
unlink($temp_path);
unlink($backendPictureUrl);
PHPWord version(s) where the bug happened
1.3.0
PHP version(s) where the bug happened
7.2
Priority
The text was updated successfully, but these errors were encountered: