Hi,
Just use a .load() method that allows a password, e.g.
load(File,String). There is no need to call openProtection() anymore.
@Maruan - can you include this in the migration guide?
Tilman
Am 26.11.2015 um 13:18 schrieb Chris Bamford:
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
Chris Bamford m: +44 7860 405292 www.mimecast.com
<http://www.mimecast.com/>
Lead Software Engineer p: +44 207 847 8700 Address click here
<http://www.mimecast.com/About-us/Contact-us/>
------------------------------------------------------------------------
http://www.mimecast.com/
<https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=2654dc9cd51e36badd01d28d5fa850b4>
LinkedIn
<https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=101a49facb5a0f2a43552553ac35cccc>
YouTube
<https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=d661e8c1e7c5f2b0998b827f60b89a3c>
Facebook
<https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=0bc2921f19cb5f10613e4c2261fa6207>
Blog
<https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=257e872e041274432a2a6d10150d7b04>
Twitter
<https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=18e31f9a532a0688ca8214b25d124fee>
<https://serviceB.mimecast.com/mimecast/click?account=C1A1&code=d8b94b9e882149c90b71cada93d1c073>
*Disclaimer*
The information contained in this communication from
*[email protected] * sent at 2015-11-26 12:18:38 is confidential
and may be legally privileged. It is intended solely for use by
*[email protected] * and others authorized to receive it. If you
are not *[email protected] * you are hereby notified that any
disclosure, copying, distribution or taking action in reliance of the
contents of this information is strictly prohibited and may be unlawful.
This email message has been scanned for viruses by Mimecast. Mimecast
delivers a complete managed email solution from a single web based
platform. For more information please visit http://www.mimecast.com