Hi,
I am looking at migrating from 1.8.8 to 2.0.0 and have been consulting the
migration guide (http://pdfbox.apache.org/2.0/migration.html).
So far I have not been able to find the correct API call sequence to decrypt a
document using a simple password.
This is what I do in 1.8.8:
BufferedInputStream bis = .. // open PDF file
PDDocument document = PDDocument.load(bis);
if (document.isEncrypted()) {
document.openProtection(new StandardDecryptionMaterial(THE_PASSWORD));
AccessPermission ap = document.getCurrentAccessPermission();
if (ap == null || ! ap.canExtractContent()) {
// give up
}
}
What is the 2.0.0 equivalent?
Thanks,
- Chris
[ YouTube: http://www.youtube.com/user/mimecast#p/u/15/_523kC3lcNQ] [ Twitter:
http://twitter.com/mimecast ] [ Our Blog: http://blog.mimecast.com/ ]
Chris Bamford
Lead Software Engineer
c: +44 7860 405292
p: +44 207 847 8700
http://www.mimecast.com
Johannesburg Map
GPS: 26' 05.940" S, 18o 28' 04.278" E
(http://maps.google.com/maps/ms?hl=en&ie=UTF8&msa=0&msid=104153695170153523925.000469102c74a808b138c≪=-26.099685,28.069403&spn=0.011986,0.026178&z=16)
Cape Town Map
GPS: 33o 56.068" S, 18o 28.320" E
(http://maps.google.com/maps/ms?source=s_q&hl=en≥ocode=&mrt=all&ie=UTF8&g=Fir+Street,+Observatory,Cape+Town&msa=0≪=-33.934753,18.4721&spn=0.00413,0.009656&z=17&msid=100887237870528382628.00046a80a3916c933dad3)
====================================================================================================================================================================
Disclaimer
This email, sent at 12:18:38 on 2015-11-26 from [email protected] to
[email protected] has been scanned for viruses and malware by Mimecast,
an innovator in software as a service (SaaS) for business. Mimecast Services
Ltd's email continuity, security, archiving and compliancy is managed by
Mimecast's unified email management platform.
To find out more, email [email protected] or request a demo.
Mimecast SA (Pty) Ltd is a registered company within the Republic of South
Africa, company registration number: 2004/000965/07 VAT No. 4650210547