[
https://issues.apache.org/jira/browse/PDFBOX-3590?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Maelig Gohin updated PDFBOX-3590:
---------------------------------
Description:
Using PdfBox 2.0.3 from maven repository.
I modified a PDF with Adobe Pro to add editable fields that I can edit with
PdfBox in JAVA.
Everything works well but I wanted to set the document as read-only so people
downloading the generated pdf could not change values.
So I followed https://pdfbox.apache.org/2.0/cookbook/encryption.html but it's
not working.
Here is my method
https://gist.github.com/mgohin/b09fed91e7475c09326d1ae25686dcd1
was:
Using PdfBox 2.0.3 from maven repository.
I modified a PDF with Adobe Pro to add editable fields that I can edit with
PdfBox in JAVA.
Everything works well but I wanted to set the document as read-only so people
downloading the generated pdf could not change values.
So I followed https://pdfbox.apache.org/2.0/cookbook/encryption.html but it's
not working.
Here is my method
private void protectDocument(PDDocument pdfDocument) throws IOException {
AccessPermission ap = new AccessPermission();
ap.setCanModify(false);
ap.setCanExtractContent(false);
ap.setReadOnly();
StandardProtectionPolicy spp = new
StandardProtectionPolicy(UUID.randomUUID().toString(), "", ap);
spp.setEncryptionKeyLength(128);
spp.setPermissions(ap);
pdfDocument.protect(spp);
}
> AccessPermission not applied
> ----------------------------
>
> Key: PDFBOX-3590
> URL: https://issues.apache.org/jira/browse/PDFBOX-3590
> Project: PDFBox
> Issue Type: Bug
> Affects Versions: 2.0.3
> Reporter: Maelig Gohin
>
> Using PdfBox 2.0.3 from maven repository.
> I modified a PDF with Adobe Pro to add editable fields that I can edit with
> PdfBox in JAVA.
> Everything works well but I wanted to set the document as read-only so people
> downloading the generated pdf could not change values.
> So I followed https://pdfbox.apache.org/2.0/cookbook/encryption.html but it's
> not working.
> Here is my method
> https://gist.github.com/mgohin/b09fed91e7475c09326d1ae25686dcd1
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]