[jira] [Commented] (PDFBOX-1716) PDDocument.getNumberOfPages() return 0 for certain PDF document

2013-09-16 Thread Thomas Chojecki (JIRA)

[ 
https://issues.apache.org/jira/browse/PDFBOX-1716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13768119#comment-13768119
 ] 

Thomas Chojecki commented on PDFBOX-1716:
-

I've tested it against the last 1.8.3 Snapshot.
The document is encrypted and use a objectstream for the pages. At the moment 
the objectstreams will be resolved on document decryption. So if you decrypt 
the document first, it should work fine. 

So try to do something like this:
pdDoc = new PDDocument(cosDoc); 
pdDoc.decrypt();
pdDoc.getNumberOfPages()

The PDDocument also provide a function isEncrypted() which will return true in 
case the document is encrypted at the moment. After decrypting it will return 
false.

This should also work for at least pdfbox 1.8.2.

 PDDocument.getNumberOfPages() return 0 for certain PDF document
 ---

 Key: PDFBOX-1716
 URL: https://issues.apache.org/jira/browse/PDFBOX-1716
 Project: PDFBox
  Issue Type: Bug
  Components: Parsing
Affects Versions: 1.8.2
Reporter: Tom
 Fix For: 1.8.2


 Sample 
 document(https://issues.apache.org/jira/secure/attachment/12430914/FormI-9-English.pdf)
  can be found here https://issues.apache.org/jira/browse/PDFBOX-578.  Looks 
 the NPE issue fix in that work item 
 https://issues.apache.org/jira/browse/PDFBOX-578 is a work around.
 When I try to extract the text content from /FormI-9-English.pdf , when I 
 call PDDocument.getNumberOfPages(), this method return 0 which makes the 
 extraction of the text content impossible:
 InputStream in = PDF  InputStream
 PDFParser parser = new PDFParser(content);
   PDFTextStripper pdfStripper = null;
   String parsedText = null;
   parser.parse();
   cosDoc = parser.getDocument();
   pdfStripper = new PDFTextStripper();
   pdDoc = new PDDocument(cosDoc);
   
   for(int i=1; i= pdDoc.getNumberOfPages(); i++) 
 { // pdDoc.getNumberOfPages() return 0, which is incorrect
 
 }
 Note:
 1. This problem is found in the PDFBox latest version 1.8.2
 2. I didn't which component to file this defect, so please assign to the 
 correct component if needed, Thanks

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (PDFBOX-1718) wrong glyphs displayed

2013-09-16 Thread Luis Bernardo (JIRA)
Luis Bernardo created PDFBOX-1718:
-

 Summary: wrong glyphs displayed
 Key: PDFBOX-1718
 URL: https://issues.apache.org/jira/browse/PDFBOX-1718
 Project: PDFBox
  Issue Type: Bug
Reporter: Luis Bernardo


java -jar app/target/pdfbox-app-2.0.0-SNAPSHOT.jar PDFToImage -imageType png 
/tmp/input.pdf

The resulting image has wrong glyphs for attached example file. Tested with 
trunk. I think further work is needed in TTFGlyph2D.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Updated] (PDFBOX-1718) wrong glyphs displayed

2013-09-16 Thread Luis Bernardo (JIRA)

 [ 
https://issues.apache.org/jira/browse/PDFBOX-1718?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Luis Bernardo updated PDFBOX-1718:
--

Attachment: input1.png
input.pdf

 wrong glyphs displayed
 --

 Key: PDFBOX-1718
 URL: https://issues.apache.org/jira/browse/PDFBOX-1718
 Project: PDFBox
  Issue Type: Bug
Reporter: Luis Bernardo
 Attachments: input1.png, input.pdf


 java -jar app/target/pdfbox-app-2.0.0-SNAPSHOT.jar PDFToImage -imageType png 
 /tmp/input.pdf
 The resulting image has wrong glyphs for attached example file. Tested with 
 trunk. I think further work is needed in TTFGlyph2D.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (PDFBOX-1719) NPE while signing PDF - acroform without fields

2013-09-16 Thread Thomas Chojecki (JIRA)
Thomas Chojecki created PDFBOX-1719:
---

 Summary: NPE while signing PDF - acroform without fields
 Key: PDFBOX-1719
 URL: https://issues.apache.org/jira/browse/PDFBOX-1719
 Project: PDFBox
  Issue Type: Bug
  Components: PDModel
Affects Versions: 1.8.2
Reporter: Thomas Chojecki
Assignee: Thomas Chojecki
 Fix For: 1.8.3, 2.0.0


Trying to sign a document that has already an AcroForm but no fields cause a 
NullPointerException.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Commented] (PDFBOX-1716) PDDocument.getNumberOfPages() return 0 for certain PDF document

2013-09-16 Thread Tom (JIRA)

[ 
https://issues.apache.org/jira/browse/PDFBOX-1716?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=13768330#comment-13768330
 ] 

Tom commented on PDFBOX-1716:
-

Thanks Andreas and Thomas for the detail explanation. I will try it.
BTW, I am not sure how to create a problematic pdf document like the sample 
pdf that can be used to show the problem. I need one instead of using the 
sample pdf (copyright thing)that can be use in my junit to verify the my code.

 PDDocument.getNumberOfPages() return 0 for certain PDF document
 ---

 Key: PDFBOX-1716
 URL: https://issues.apache.org/jira/browse/PDFBOX-1716
 Project: PDFBox
  Issue Type: Bug
  Components: Parsing
Affects Versions: 1.8.2
Reporter: Tom
 Fix For: 1.8.2


 Sample 
 document(https://issues.apache.org/jira/secure/attachment/12430914/FormI-9-English.pdf)
  can be found here https://issues.apache.org/jira/browse/PDFBOX-578.  Looks 
 the NPE issue fix in that work item 
 https://issues.apache.org/jira/browse/PDFBOX-578 is a work around.
 When I try to extract the text content from /FormI-9-English.pdf , when I 
 call PDDocument.getNumberOfPages(), this method return 0 which makes the 
 extraction of the text content impossible:
 InputStream in = PDF  InputStream
 PDFParser parser = new PDFParser(content);
   PDFTextStripper pdfStripper = null;
   String parsedText = null;
   parser.parse();
   cosDoc = parser.getDocument();
   pdfStripper = new PDFTextStripper();
   pdDoc = new PDDocument(cosDoc);
   
   for(int i=1; i= pdDoc.getNumberOfPages(); i++) 
 { // pdDoc.getNumberOfPages() return 0, which is incorrect
 
 }
 Note:
 1. This problem is found in the PDFBox latest version 1.8.2
 2. I didn't which component to file this defect, so please assign to the 
 correct component if needed, Thanks

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Resolved] (PDFBOX-1719) NPE while signing PDF - acroform without fields

2013-09-16 Thread Thomas Chojecki (JIRA)

 [ 
https://issues.apache.org/jira/browse/PDFBOX-1719?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Thomas Chojecki resolved PDFBOX-1719.
-

Resolution: Fixed

Fixed in rev
1523680 for 2.0.0
1523675 for 1.8.3


 NPE while signing PDF - acroform without fields
 ---

 Key: PDFBOX-1719
 URL: https://issues.apache.org/jira/browse/PDFBOX-1719
 Project: PDFBox
  Issue Type: Bug
  Components: PDModel
Affects Versions: 1.8.2
Reporter: Thomas Chojecki
Assignee: Thomas Chojecki
 Fix For: 1.8.3, 2.0.0


 Trying to sign a document that has already an AcroForm but no fields cause a 
 NullPointerException.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


[jira] [Created] (PDFBOX-1720) BouncyCastle 1.49: ambigous constructor usage

2013-09-16 Thread Tilman Hausherr (JIRA)
Tilman Hausherr created PDFBOX-1720:
---

 Summary: BouncyCastle 1.49: ambigous constructor usage
 Key: PDFBOX-1720
 URL: https://issues.apache.org/jira/browse/PDFBOX-1720
 Project: PDFBox
  Issue Type: Improvement
  Components: PDModel
Affects Versions: 2.0.0
Reporter: Tilman Hausherr
Priority: Minor


pdfbox\pdmodel\encryption\PublicKeySecurityHandler.java:

EnvelopedData env = new EnvelopedData(null, derset, 
encryptedcontentinfo, null);
is ambigous *if* one would use the latest (1.49) version of bouncycastle and 
doesn't compile. One has to choose one of the two constructors by setting a 
type for the last null. Looking at the constructor for 1.49, the solution 
would be:

Solution:
EnvelopedData env = new EnvelopedData(null, derset, 
encryptedcontentinfo, (ASN1Set) null);


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira