pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sundaravadivelu, Subramani [TNQ]" <subraman...@tnq.co.in>
Subject WrappedIOException and Java heap space
Date Thu, 01 Dec 2011 09:43:36 GMT
Hi All,

 

I am a very long user of PDFBOX from version 0.7.3.

 

Recently I updated to the latest version i.e., v1.6.0 of PDFBOX into my
application.

 

But I was reported a strange problem from my customer stating that for some
selected PDFs it throws exception.

 

The same was fine with the version 1.1.0 of PDFBOX.

 

Below is the error thrown in Eclipse JAVA IDE when I run the PDF (around 300
MB in size)

with the version 1.6.0.

 

org.apache.pdfbox.exceptions.WrappedIOException
at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:240)
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1090)
at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1054)
at org.apache.pdfbox.pdmodel.PDDocument.main(PDDocument.java:1378)
Caused by: java.lang.OutOfMemoryError: Java heap space
at
org.apache.pdfbox.io.RandomAccessBuffer.expandBuffer(RandomAccessBuffer.java
:151)
at
org.apache.pdfbox.io.RandomAccessBuffer.write(RandomAccessBuffer.java:131)
at
org.apache.pdfbox.io.RandomAccessFileOutputStream.write(RandomAccessFileOutp
utStream.java:108)
at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
at java.io.FilterOutputStream.close(FilterOutputStream.java:140)
at
org.apache.pdfbox.pdfparser.BaseParser.parseCOSStream(BaseParser.java:448)
at org.apache.pdfbox.pdfparser.PDFParser.parseObject(PDFParser.java:552)
at org.apache.pdfbox.pdfparser.PDFParser.parse(PDFParser.java:184)

 

 

In v1.1.0 without any memory allocation (ie using the option -Xmx), I was
able to run the PDF successfully without this exception.

 

But with the version v1.6.0, I need to use the option  "-Xmx" option and
allocate around 1250m size of memory to run the same pdf.

 

Is there any work around to avoid this issue? Please advice.

 

Regards,

Subbu


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message