Guilhermo created PDFBOX-4580:
---------------------------------
Summary: PDFTextStripper::getText() lead to OutOfMemoryError: Java
heap space
Key: PDFBOX-4580
URL: https://issues.apache.org/jira/browse/PDFBOX-4580
Project: PDFBox
Issue Type: Bug
Affects Versions: 2.0.15
Reporter: Guilhermo
Attachments: ceh.pdf
I just discovered a memory issue (Java heap space) that happen only if we try
to use stripper.getText(pdfFile) on a pdf that has missing incorporated fonts
(like the one in attachment).{color:#cc7832}
{color}
To replicate the issue you can use this snippet with the pdf file in attachment:
{code:java}
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
import java.io.IOException;
import java.io.InputStream;
public class OutOfMemoryExample {
public static void main(String[] args) throws IOException {
try(InputStream docStream =
Thread.currentThread().getContextClassLoader().getResource("ceh.pdf").openStream();
PDDocument cd = PDDocument.load(docStream)){
PDFTextStripper stripper = new PDFTextStripper();
// OutOfMemory here
String pdfText = stripper.getText(cd);
System.out.println(pdfText);
}
}
}
{code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]