pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Barry Zhao [Zhao]" <zhaz...@tibco-support.com>
Subject About decrypt pdf using pdfbox 2.0.1
Date Fri, 01 Jul 2016 09:16:15 GMT
Hello team,

I found a weird thing when upgrading pdfbox from 1.8.7 to 2.0.1.

Here is my scenario below.

I used a pdf template which was encrypted. And my code is like below.

*import java.io.File;*
*import java.io.IOException;*
*import java.util.List;*
*import javax.xml.parsers.ParserConfigurationException;*
*import org.apache.pdfbox.pdmodel.PDDocument;*
*import org.apache.pdfbox.pdmodel.PDDocumentCatalog;*
*import org.apache.pdfbox.pdmodel.interactive.form.PDAcroForm;*
*import org.apache.pdfbox.pdmodel.interactive.form.PDField;*
*import org.xml.sax.SAXException;*

*public class Testpdf9 {*

* public static void main(String[] args) throws IOException,
ParserConfigurationException, SAXException {*
* String file = "E:\\pdf_issues\\Items\\samplepdfread1.pdf";*
* PDDocument doc = PDDocument.load(new File(file));*
* PDDocumentCatalog catalog = doc.getDocumentCatalog();*
* PDAcroForm form = catalog.getAcroForm();*
* List fields = form.getFields();*
* for(int i=0;i<fields.size();i++){*
* Object field = fields.get(i);*
* System.out.println(((PDField)field).getFullyQualifiedName());*
* System.out.println(field.getClass().getSimpleName());*
* }*
* doc.close();*
* }*
*}*

1. If I use PDFBox 1.8.7, then I will get the messy code of the form field
names.
2. If I use PDFBox 2.0.1, then I will get the right name of the form fields.
3. If I use PDFBox 1.8.7, then I must modify my code to decrypt the pdf and
then I can get the right names. While changing to PDFBox 2.0.1, I don't
need to do additional change.

You can run my code by using my attaching file. The password is abcd.

So above all, my question is that, is this an issue in PDFBox 2.0.1? Or
some other reasons?

Please let me know your reply. Thank you in advance.


-- 
Best Regards,
Barry

Mime
View raw message