Editing password protected pdfs with fpdi

2019-07-19 01:42发布

问题:

I've been trying to add a watermark to a password protected pdf (protect to write only) with fpdf and fpdi.

It works on normal pdfs but when it is password protected it gives this error:

FPDF error: This document (upd/509ae4a4044df9a43e03e09b4cf772b0.pdf) probably uses a compression technique which is not supported by the free parser shipped with FPDI.

It makes sense that it isn't possible to write on the document but while searching I've seen similar problems getting resolved.

Thanks in advanced.

回答1:

According to the manual, the free version cannot process secured files. They can be processed only with the paid version.

The error above however occurs also in non-secured files. It can be overcome by re-saving the template and change compression type.

In Adobe Acrobat Pro go to File->Save As->Optimised PDF-> Popup left list - Clean Up,

Object Compression Options -> Change to "Compress document structure" -> OK to save