Bug 695217 - MuPDF 1.4 drawing on Protected PDF
Summary: MuPDF 1.4 drawing on Protected PDF
Status: RESOLVED FIXED
Alias: None
Product: MuPDF
Classification: Unclassified
Component: mupdf (show other bugs)
Version: 1.4
Hardware: Android Phone Android
: P4 normal
Assignee: Matt Holgate
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-08 01:04 UTC by Ahmad Kayyali
Modified: 2014-06-27 07:19 UTC (History)
3 users (show)

See Also:
Customer:
Word Size: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ahmad Kayyali 2014-05-08 01:04:47 UTC
I have been using MuPDF 1.2 for a while in my android application.

I have protected PDfs owner's and user's password, MuPDF 1.2 asks me to enter user's password to be able to preview the PDF.

I never used the highlighting feature in MUPDF 1.2 so I am not familiar with MuPDF handling protected PDF with owner password, so then I decided to upgrade the version of MuPDF to 1.4, no major changes on the android for me.

what I am trying to accomplish now is allow the user to draw of the PDF using MuPDF 1.4, the issue is:

MuPDF 1.4 fail to save user drawing on the PDF, my closest guess is because it's protected with owner password, I have looked up the save function `MuPDFCore_saveInternal` but it does not have password parameter in order to save the PDF drawings.

Please let me know if I need to modify anything on order to make this work, or should I understand that MuPDF 1.4 does not support drawings on protected PDF when using both users and owner password.

many thanks.
Comment 1 Matt Holgate 2014-06-26 11:22:53 UTC
Unfortunately MuPDF does not currently support writing out encrypted PDFs.

However, it looks like we actually try to do so, and end up writing unencrypted annotations to the end of the original encrypted file. Although the save succeeds, re-loading the modified PDF silently fails, and the annotations are not displayed (only the original content).

This file corruption is a bug which we will fix for now by disabling annotation editing for encrypted files. We recommend that you do the same for your application (once I've implemented this, I'll post the commit here, so you can see how it can be done).

Ideally though, in the long term, we'd be able to support saving out of encrypted files, so I'll open a separate enhancement bug for this feature.

Thanks for reporting this issue.
Comment 2 Matt Holgate 2014-06-26 11:27:47 UTC
Opened bug #695336 to track feature request for saving annotations to encrypted files.
Comment 3 Matt Holgate 2014-06-27 07:18:26 UTC
commit 063a723b9fa50200192b01ba976ecd551461a8dc
Author: Matt Holgate <matt@emobix.co.uk>
Date:   Fri Jun 27 12:30:39 2014 +0100

    Fix #695217 - don't allow annotation of encrypted PDFs

commit 5587d318d8495d15fb9157ea8c0a925e6e590e00
Author: Matt Holgate <matt@emobix.co.uk>
Date:   Fri Jun 27 15:11:00 2014 +0100

    iOS - Fix #695217 - don't allow annotation of encrypted PDFs
Comment 4 Matt Holgate 2014-06-27 07:19:15 UTC
Closing this, as it's now not possible to annotate an encrypted file, and the separate bug #695336 has been opened to track the enhancement to implement this.