Forum


Replies: 1   Views: 3404
Handling exception.
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 ajstern  · 09-05-2018 - 05:54

Hello,

While adding watermark to the documents am getting TCPDF_PARSER ERROR: decodeFilterFlateDecode: invalid code error. because the document is password protected hence getting such errors.

So, in this case, I want to download document without having a watermark but am unable to catch/handle this error so please help me to avoid this error.  

 

 

 

Posted by admin  · 09-05-2018 - 06:28

Hello,

Please read the information available on:

https://www.phpdocx.com/documentation/cookbook/repair-PDF

You need to use not protected documents or unprotect them.

If you need to handle the Exception, you just need to catch it:

try {
  $merge->mergePdf(array('document1.pdf', 'document2.pdf'), 'output.pdf');
} catch (Exception $e) {
  // handle the exception
}

Regards.