Forum


Replies: 3   Views: 2955
Embedded fpdi conflicts
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  · 09-11-2016 - 09:49

Here is a simple code sample we use :

     $pdf = new FPDI();
        $pageCount = $pdf->setSourceFile($filename);
        for ($i = 1; $i <= $pageCount; $i++) { 
                $tplidx = $pdf->ImportPage($i);
                $pdf->AddPage();
                $pdf->useTemplate($tplidx);
                if ($i != $pageCount or $pageCount == 1){
                        $pdf->Image('00123456.png',178,45,0);
                }
        }
        $pdf->Output($filename, 'F');

Basically, it adds an image on each page of a PDF file.

Until we buy PHPDOCX, we were using this program and all was working fine. But now we include PHPDOCX in our scripts and its seems that it has its own embedded FPDI version.

The problem is that this embedded version is slightly different from the older one we had, and now, using the program above adds strange borders to our documents.

So is there a way to include both PHPDOCX and another FPDI version without having conflicts ? Or is there something we can do to remove those strange borders (on top and bottom of document) ?

Regards

Posted by admin  · 09-11-2016 - 11:21

Hello,

You can replace the included FPDI library in the lib folder of the package by any other version.

The phpdocx namespaces package doesn't have conflict names when using other libraries, This package is available in Advanced and Premium licenses.

Regards.

Posted by Edics  · 09-11-2016 - 13:42

Thank you for your support.

Actually, i found out how to fix this problem without having to change embedded library.

     $pdf = new FPDI();
        $pdf->setPrintHeader(false);
        $pdf->setPrintFooter(false);

Turns out that in your version, those two parameters are set to 'TRUE' by default. So i just had to switch them.

Regards

Posted by admin  · 09-11-2016 - 14:42

Hello,

Phpdocx 6 added those changes, maybe you are using an old version of phpdocx.

Regards.