Replies: 3   Views: 3975
Pdf merger adding font
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Edics  · 07-06-2016 - 11:44


When i use your object "MultiMerge" and his method "mergePdf", it adds me a new refered font into the result PDF file (in our case its Helvetica, type 1).

I'd like to know why and how can we embed this font if necessary.

We need, in our process, to embed all fonts in PDF files to avoid printing issues.


Posted by admin  · 07-06-2016 - 13:56


How did you generate the PDF files you're merging? We recommend you to embed the fonts into the PDF documents before merging it. Other approach is to install the needed fonts in the OS that are generating the PDF.

Phpdocx uses TCPDF and FPDI to merge PDF files. You can change their default values such as the helvetica font family in the lib folder of the package.

The current version of phpdocx doesn't include an option to change these default values but we've added a task to include it in a next version of the library.


Posted by Edics  · 07-06-2016 - 15:15


We generate our PDF files with Apache FOP. All needed fonts are already embed before merging the PDF files. Actually, it is the method "mergePdf" who adds an un-embedded font.

Is there an option somewhere in your source code where to specify how to embed fonts using FPDI ?


Posted by admin  · 07-06-2016 - 16:01


There's no option to acomplish what you need, so you should change the library code. You should change the method mergePdf in the MultiMerge class using the SetFont method from TCPDF to embed a new font. This is the signature of the method available in lib/fpdf-tpl/fpdf-tpl.php:

public function SetFont($family, $style = '', $size = 0)

You can read more information about this method on: