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 17:34:00 UTC

[jira] [Resolved] (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:all-tabpanel ]

Tilman Hausherr resolved PDFBOX-4580.
-------------------------------------
    Resolution: Fixed

> 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
>          Components: FontBox
>    Affects Versions: 2.0.15
>            Reporter: Guilhermo
>            Assignee: Tilman Hausherr
>            Priority: Major
>             Fix For: 2.0.17, 3.0.0 PDFBox
>
>         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