Das in der docx-Datei angezeigte Bild ist im PDF nicht sichtbar, wenn es mit unoconv konvertiert wird
Posted: 13 Jan 2025, 12:58
Das in der docx-Datei angezeigte Bild ist im PDF nicht sichtbar, wenn es mit unoconv konvertiert wird, wo das Bild mit
angezeigt wird
Hier ist der unoconv-Code
angezeigt wird
Code: Select all
$document = new \PhpOffice\PhpWord1\TemplateProcessor($docx_temp_file_path);
$imagePath = '/abc.png';
if (file_exists($imagePath)) {
$document->setImageValue($key, $imagePath);
}
Code: Select all
public function docxToPdf( $docx_file_path, $pdf_file_path )
{
$pythonPath = '/usr/bin/python';
$unoconvPath = '/usr/bin/unoconv';
$command = sprintf(
'"%s" "%s" -f pdf "%s" 2>&1',
$pythonPath,
$unoconvPath,
$docx_file_path
);
exec($command, $output, $return);
//
if (is_array($output) && !empty($output[0])) {
throw new Exception(json_encode(implode('; ', $output), true));
}
return true;
}