Q: Our application allows a user to add/remove pages to and from different PDFs. For example, a user could potentially upload a password protected PDF, then move one page from that PDF to another PDF. Then we rely on PDFNet to save the new byte arrays for the two PDFs. Can PDFNet move pages from a secured PDF to an open PDF, and save the byte arrays FOR BOTH PDFDoc Objects? These new byte arrays need to be used then in the future to reconstruct a PDFDoc object, which may be manipulated further.
You said: " You can identify documents that require open pass with
InitSecurityHandler() as shown in EncTest sample". That sample looks like if the PDFDoc.InitSecurityHandler() method call returns false, then a password is required. Is that correct?
A: A PDF document can be secured with 2 types of password: permission (owner) and user (open).
If document is secured with user (open) you need to provide the pass in order to open the file and there is no way around it.
If document is secured with just a permission (owner) you don’t need to provide the pass in order to open the file.
You can identify documents that require open pass with InitSecurityHandler() as shown in EncTest sample.
Unfortunately in PDF, encryption works on a document and not on a page level - so you can’t (easily) manipulate pages on a page level without need for pass.
PDFDoc.InitSecurityHandler() method call returns false, then a password is required. Is that correct?
Correct.