We're using pdfbox-1.8.1.jar to convert PDF to JPGs.
Below is part of a stacktrace we see when converting a PDF of size 500Kb
java.lang.IllegalArgumentException: Width (4032) and height (-2880) cannot be
<= 0
at
java.awt.image.DirectColorModel.createCompatibleWritableRaster(Unknown Source)
at java.awt.image.BufferedImage.<init>(Unknown Source)
at org.apache.pdfbox.pdmodel.PDPage.convertToImage(PDPage.java:752)
at
org.apache.pdfbox.util.PDFImageWriter.writeImage(PDFImageWriter.java:115)
----------------
This is the header and footer of the PDF file:
%PDF-1.4
%
1 0 obj
<<
/Type /Pages /Count 1 /Kids [ 8 0 R ]
>>
endobj
2 0 obj
<<
/Type /Catalog /ViewerPreferences <<
/NonFullScreenPageMode /UseOutlines >>
/Pages 1 0 R >>
endobj
3 0 obj
<<
/Producer (PDF-XChange \(xcpro30.dll v3.40.0074\) \(Windows 2k\))
/CreationDate (D:20050311152944-06'00')
/Author ()
/Title ()
/Subject ()
/Keywords ()
/Creator (AcroPlot Pro \(Build 2005-02-07\) - www.cadzation.com)
>>
endobj
4 0 obj
<</Length1 20112 /Length 9172 /Filter [ /FlateDecode ]
>>
stream
................................................................................
endstream
endobj
8 0 obj
<<
/Type /Page /Parent 1 0 R /Resources <<
/Font <<
/F1 6 0 R >>
>>
/MediaBox [ 0 2160 3024 0 ]
/Contents [ 7 0 R ]
>>
endobj
xref
0 9
0000000000 65535 f
0000000013 00000 n
0000000076 00000 n
0000000192 00000 n
0000000441 00000 n
0000009708 00000 n
0000009989 00000 n
0000010386 00000 n
0000583350 00000 n
trailer
<<
/Size 9 /Info 3 0 R /Root 2 0 R /ID [ <6A5A32742A221E93F44AD2E93D4134B2>
<6A5A32742A221E93F44AD2E93D4134B2>
]
>>
startxref
583492
%%EOF
-------------------
Is this a bug? The PDF file opens correctly in adobe. So probably it is not
corrupt.
Thanks
Asmita