pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Stahle, Patrick" <patrick.sta...@te.com>
Subject RE: Strange "Save As" issue with Adobe Reader 11 / DC with PDF being encrypted by PDFBox 2 snapshot
Date Wed, 16 Mar 2016 19:45:10 GMT
Also other applications like PDF Exchange do not exhibit the problem. Most likely has something
to do with the 3D capabilities of Adobe Reader....

-----Original Message-----
From: Tilman Hausherr [mailto:THausherr@t-online.de] 
Sent: Wednesday, March 16, 2016 3:38 PM
To: users@pdfbox.apache.org
Subject: Re: Strange "Save As" issue with Adobe Reader 11 / DC with PDF being encrypted by
PDFBox 2 snapshot

Can you reopen the file you saved with PDFBox? If not, please open an issue in JIRA and attach
your file.

If yes, just upload the file somewhere, I'd like to have a look at the encryption dictionaries.

Tilman

Am 16.03.2016 um 20:19 schrieb Stahle, Patrick:
> Hi,
>
> This is not a general problem and only occurs with original PDF generated with 3D content
using Anark. The file when loaded seems to have encrypted and loads just find in Adobe Reader,
but when we try to do a "Save As" we get the following error:
> "The document could not be saved. There was a problem reading this document 21."
>
> If I do a control click on the "ok" button. I get the following message:
> "This direct object already has a container."
>
> Any ideas what might be causing this problem? We have tried the same thing with iText
and it does not experience this problem.
>
> Sample Code that reproduces the problem:
>                                  PDDocument doc = null;
>
>                                  try {
>                                                  doc = PDDocument.load(pdfIn);
>                                                  PDPage page = null;
>                                                  AccessPermission apermission = new AccessPermission();
>                                                  apermission.setCanAssembleDocument(false);
>                                                  apermission.setCanExtractContent(false);
>                                                  apermission.setCanExtractForAccessibility(true);
>                                                  apermission.setCanFillInForm(true);
>                                                  apermission.setCanModifyAnnotations(true);
>                                                  apermission.setCanPrint(true);
>                                                  apermission.setReadOnly();
>                                                  StandardProtectionPolicy spp = new StandardProtectionPolicy(UUID.randomUUID().toString(),
"", apermission);
>                                                  doc.protect(spp);
>
>                                                  for (int i = 0; i < doc.getNumberOfPages();
i++) {
>                                                                  page = doc.getPage(i);
>                                                                  PDPageContentStream
canvas = new PDPageContentStream(doc, page, PDPageContentStream.AppendMode.APPEND, true, true);
>                                                                  canvas.saveGraphicsState();
>                                                                  canvas.restoreGraphicsState();
>                                                                  canvas.close();
>                                                  }
>                                                  doc.save(pdfOut);
>                                                  bRet = true;
>                                  }
>                                  finally {
>                                                  if (doc != null) {
>                                                                  doc.close();
>                                                  }
>                                  }
>
> Thanks,
> Patrick
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: users-help@pdfbox.apache.org


Mime
View raw message