Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: 4.3.3
-
Fix Version/s: 5.0.1
-
Component/s: Core/Parsing
-
Labels:None
-
Environment:ICEpdf 4.3.3 PRO
-
Salesforce Case Reference:
Description
Attached image produces an NPE exception similar to the following:
Exception in thread "main" java.lang.NullPointerException
at org.icepdf.core.pobjects.Document.getPageImage(Document.java:1063)
I did some debugging and found that statements:
Document document = new Document();
document.setFile(filePath);
create a new document object, but getNumberOfPages() method of this object always return zero. Furthermore an exception is thrown when the following line executed thereafter:
int number = document.getNumberOfPages();
BufferedImage image = (BufferedImage) document.getPageImage( number, GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, rotation, scale); <<< NPE thrown at this line
Exception in thread "main" java.lang.NullPointerException
at org.icepdf.core.pobjects.Document.getPageImage(Document.java:1063)
I did some debugging and found that statements:
Document document = new Document();
document.setFile(filePath);
create a new document object, but getNumberOfPages() method of this object always return zero. Furthermore an exception is thrown when the following line executed thereafter:
int number = document.getNumberOfPages();
BufferedImage image = (BufferedImage) document.getPageImage( number, GraphicsRenderingHints.SCREEN, Page.BOUNDARY_CROPBOX, rotation, scale); <<< NPE thrown at this line
The file to reproduce issue has been attached