You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "Tilman Hausherr (JIRA)" <ji...@apache.org> on 2019/06/26 06:42:00 UTC
[jira] [Commented] (PDFBOX-4580) PDFTextStripper::getText() lead to
OutOfMemoryError: Java heap space
[ https://issues.apache.org/jira/browse/PDFBOX-4580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16872993#comment-16872993 ]
Tilman Hausherr commented on PDFBOX-4580:
-----------------------------------------
Using the trunk, with -Xmx1g I also get an OOM, with -Xmx2g I get
{noformat}
java.lang.IllegalArgumentException: The expected SubstFormat for LigatureSubstitutionTable is 1
org.apache.fontbox.ttf.GlyphSubstitutionTable.readLigatureSubstitutionSubtable(GlyphSubstitutionTable.java:326)
org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupTable(GlyphSubstitutionTable.java:277)
org.apache.fontbox.ttf.GlyphSubstitutionTable.readLookupList(GlyphSubstitutionTable.java:239)
org.apache.fontbox.ttf.GlyphSubstitutionTable.read(GlyphSubstitutionTable.java:103)
org.apache.fontbox.ttf.TrueTypeFont.readTable(TrueTypeFont.java:377)
org.apache.fontbox.ttf.TTFParser.parseTables(TTFParser.java:173)
org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:150)
org.apache.fontbox.ttf.TTFParser.parse(TTFParser.java:106)
org.apache.pdfbox.pdmodel.font.PDTrueTypeFont.<init>(PDTrueTypeFont.java:108)
org.apache.pdfbox.pdmodel.font.PDFontFactory.createFont(PDFontFactory.java:89)
{noformat}
But it works fine with -Xmx1g with 2.0.16.
> 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
> Assignee: Andreas Lehmkühler
> Priority: Major
> 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).
>
> 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: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org