When i convert a file(docx) to pdf the text zones inside the document are "destroyed" and the content of these zones is on the the top of the document, left aligned.
Steps to Reproduce
This is my class"
<?php
require __DIR__ . '/../vendor/autoload.php';
use PhpOffice\PhpWord\IOFactory;
use PhpOffice\PhpWord\Settings;
class WordToPdf
{
public function __construct(
private string $file_path
) {
}
public function toPDF(): bool
{
Settings::setPdfRendererName(Settings::PDF_RENDERER_MPDF);
Settings::setPdfRendererPath('.');
if (file_exists($this->file_path) && pathinfo($this->file_path, PATHINFO_EXTENSION) == 'docx') {
$phpWord = IOFactory::load($this->file_path, 'Word2007');
$phpWord->save(str_replace('.docx', ".pdf", $this->file_path), 'PDF');
return true;
}
return false;
}
}
Describe the Bug
When i convert a file(docx) to pdf the text zones inside the document are "destroyed" and the content of these zones is on the the top of the document, left aligned.
Steps to Reproduce
This is my class"
Expected Behavior
What i have : https://ibb.co/8xSJkzd, what i want (the original word): https://ibb.co/6NPDSht.
Context