So I tested transformDocument with an embedded font. It works fine when using "replaceVariableByText" but it doesn't work when using "replaceVariableByHTML".
In the code below, "Template.docx" is a template with embedded font and only one variable named $hello$ in the template. The embedded font is not installed in our Linux server.
Here is a code that works:
$docx = new CreateDocxFromTemplate('Template.docx');
$docx->replaceVariableByText(array('hello' => 'Hello world'));
$docx->createDocx('TestTransformDocument.docx');
$docx->transformDocument('TestTransformDocument.docx', 'TestTransformDocument.pdf', 'libreoffice');
And here is a code that doesn't work:
$docx = new CreateDocxFromTemplate('Template.docx');
$docx->replaceVariableByHTML('hello', 'block', 'Hello world');
$docx->createDocx('TestTransformDocument.docx');
$docx->transformDocument('TestTransformDocument.docx', 'TestTransformDocument.pdf', 'libreoffice');
In the first case, with "replaceVariableByText", we get a document with the text 'Hello world' in the embedded font (even though the font is not installed in our server).
In the first case, with "replaceVariableByHTML", we get a document with the text 'Hello world' in another default font, which is not the embedded font.
What are we doing wrong?