We have faced this issue while using print module using mPDF library. If you try to open a generated PDF using Adobe Reader for Android, for example, it fails to open.

We found out that commenting the line below on print_pdf_mpdf.pages.inc file solves the issue.

$mpdf->SetProtection(array('copy', 'print', 'print-highres'), '', '');

It seems that, even having an empty password set makes mPDF to set file encryption, making the file unreadable on some Android readers.

Following is the ouput of pdftk running on Ubuntu:

With $mpdf->SetProtection() line commented:

iluz ~ > pdftk myfile.pdf dump_data
InfoKey: Producer
InfoValue: mPDF 5.4
InfoKey: ModDate
InfoValue: 20130219162413-03'00'
InfoKey: CreationDate
InfoValue: 20130219162413-03'00'
PdfID0: 7f73d322ab8154a6ad71fedae77edf8
PdfID1: 7f73d322ab8154a6ad71fedae77edf8
NumberOfPages: 1

With $mpdf->SetProtection() line uncommented:

iluz ~ > pdftk myfile-1.pdf dump_data
Error: Failed to open PDF file: 
   free-trial-offer-coupon-local.pdf
   OWNER OR USER PASSWORD REQUIRED, but not given (or incorrect)
Done.  Input errors, so no output created.

Any alternatives?

[]s
Ivam

Comments

jcnventura’s picture

Status: Active » Closed (duplicate)

Indeed, that line isn't doing anything there.

It will go away when I commit #1820736: allow drupal_alter() of mpdf before write.

Marking this as duplicate because the other is the proper solution to the problem.