Hi Asmita,

could you upload the PDF to a location from where we can download it? Didn't 
make it through the mailing list.

BR
Maruan Sahyoun

Am 13.05.2013 um 22:09 schrieb Asmita Joshi <[email protected]>:

> We use PDDocument.load(File). As suggested, we tried with loadNonSeq and also 
> the non sequential form of load as below. Also tried it with a 
> FileInputStream and File. All these forms of load gave us the same error. 
> ---
>          raf = new RandomAccessFile(new File("/tmp/nonSeqPdfFile"), "rw");
>          document = PDDocument.load(new FileInputStream(inputFile), raf);
>            PDFImageWriter imageWriter = new PDFImageWriter();
>            success = imageWriter.writeImage(document, imageFormat, password, 
> startPage, endPage, pdfWorkFilePrefix, imageType, resolution);
> ---
> Attaching one of the pdfs that causes this issue.
> 
> Thanks
> Asmita
> 
> ________________________________________
> From: Maruan Sahyoun [[email protected]]
> Sent: Monday, May 06, 2013 9:38 PM
> To: [email protected]
> Subject: Re: IllegalArgumentException while converting pdf to jpg - 
> pdfbox-app-1.8.1.jar
> 
> Hi Asmita,
> 
> how did you load the PDF. DId you use PDDocument.load or 
> PDDocument.loadNonSeq? If it's PDDocument.load could you try 
> PDDocument.loadNonSeq instead. Can you share a code snippet with us showing 
> how you are converting the PDF? Is there a sample PDF?
> 
> BR
> Maruan Sahyoun
> 
> Am 07.05.2013 um 00:44 schrieb Asmita Joshi <[email protected]>:
> 
>> 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
> 

Reply via email to