Hi All,
I'm trying to execute the following code:

PdfReader reader = new PdfReader("/path/to/file.pdf");
int pages = reader.getNumberOfPages();


It works on most files, but on one particular file, it crashes with error:


java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:2882)
        at
java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
        at 
java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:572)
        at java.lang.StringBuffer.append(StringBuffer.java:320)
        at com.itextpdf.text.pdf.PRTokeniser.readString(PRTokeniser.java:158)
        at com.itextpdf.text.pdf.PRTokeniser.getStartxref(PRTokeniser.java:224)
        at com.itextpdf.text.pdf.PRTokeniser.getStartxref(PRTokeniser.java:229)
        ...goes on for a while
        at com.itextpdf.text.pdf.PRTokeniser.getStartxref(PRTokeniser.java:229)


I know that it's something wrong with the input file. I'm just wondering if
there's a way of knowing before attempting to make the method call, that the
file is going to cause a problem.


--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/itext-outOfMemoryError-when-attempting-to-count-number-of-pages-in-a-PDF-file-tp3701287p3701287.html
Sent from the iText - General mailing list archive at Nabble.com.
------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to