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 2023/12/15 11:11:00 UTC

[jira] [Commented] (PDFBOX-5479) PDFTextStripper needs 1GB heap for a 3.6 MB pdf

    [ https://issues.apache.org/jira/browse/PDFBOX-5479?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17797141#comment-17797141 ] 

Tilman Hausherr commented on PDFBOX-5479:
-----------------------------------------

https://d-nb.info/1312454512/34

Different font objects that point to the same font file. So the font is opened each time and all tables are read and stored. And since 3.0 we read much more tables than in 2.0.

> PDFTextStripper needs 1GB heap for a 3.6 MB pdf
> -----------------------------------------------
>
>                 Key: PDFBOX-5479
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-5479
>             Project: PDFBox
>          Issue Type: Improvement
>          Components: Text extraction
>    Affects Versions: 2.0.26
>         Environment: JDK11.0.2 on MacOS 12.4
>            Reporter: Manfred Schauer
>            Priority: Minor
>         Attachments: heapDump.png, x.pdf
>
>
> Extracting text from the attached x.pdf:
> PDDocument pdDocument = PDDocument.load(new File("/tmp/x.pdf"));
> PDFTextStripper stripper = new PDFTextStripper();
> stripper.getText(pdDocument);
> succeeds with -Xmx1G but throws OOME with -Xmx900m
> Heapdump shows 2923 instances of TrueTypeFont, PDRessources.cache contains SoftReferences to lots of fonts keyed by different COSObjects;



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org