Hey guys thanks so much for letting me know about the encryption!

@Thomas, I ran the .decrypt() method and it seems to be working but I'm
getting an exception on saving the document out.

The method I'm calling is just a doc.save(String "path to output file");

java.lang.NullPointerException
at
org.apache.pdfbox.pdmodel.encryption.StandardSecurityHandler.prepareDocumentForEncryption(StandardSecurityHandler.java:303)
at org.apache.pdfbox.pdfwriter.COSWriter.write(COSWriter.java:1446)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1273)
at org.apache.pdfbox.pdmodel.PDDocument.save(PDDocument.java:1254)
at PDFStamper.stamp(PDFStamper.java:129)
at PDFStamper.main(PDFStamper.java:174)


Any ideas here?

Thanks so much!

Leonard


On Sun, May 26, 2013 at 6:07 PM, Thomas Chojecki <[email protected]> wrote:

> Hi Leonard,
> as Gilad already said, the document is encrypted. Most of the documents
> can be decrypt with a default password. Just use null or a empty string to
> decrypt the pdf.
>
> Put this lines after PDDocument.load(...)
>
> if (doc.isEncrypted()) {
>   doc.decrypt("");
> }
>
> Best regards
> Thomas
>
>
> Zitat von Leonard Teo <[email protected]>:
>
>  Hi guys,
>>
>> I'm having an issue with a specific PDF and PDFBox 1.8.1.
>>
>> This is what I'm doing:
>> List pages = doc.getDocumentCatalog().**getAllPages();
>> pages.size() will return 0
>>
>> Here is the PDF:
>> https://dl.dropboxusercontent.**com/u/1413139/Est_Limits_of_**
>> Civil_Government.pdf<https://dl.dropboxusercontent.com/u/1413139/Est_Limits_of_Civil_Government.pdf>
>>
>> Full Source Code:
>> https://gist.github.com/**leonardteo/**a1dec98bfd1cbe6b919d<https://gist.github.com/leonardteo/a1dec98bfd1cbe6b919d>
>>
>> Do you guys know what is the issue with this specific PDF that would be
>> causing PDFBox to think that it has 0 pages?
>>
>> Thanks,
>>
>> Leonard
>>
>>
>>
>>
>> --
>> Leonard Teo
>> Ballistiq Digital, Inc.
>> http://www.ballistiq.com
>> 2001 University Street, Suite 1700
>> Montreal, QC H3A 2A6
>>
>> Cell: 514 512 9873
>> Skype: leonardteo
>>
>
>
>
>


-- 
Leonard Teo
Ballistiq Digital, Inc.
http://www.ballistiq.com
2001 University Street, Suite 1700
Montreal, QC H3A 2A6

Cell: 514 512 9873
Skype: leonardteo

Reply via email to