[
https://issues.apache.org/jira/browse/PDFBOX-6353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18154212#comment-18154212
]
Maruan Sahyoun commented on PDFBOX-6353:
----------------------------------------
Thanks for the report. Your analysis is correct. PDFTextStripper already
handles this, so we'll apply the same approach to PDFMarkedContentExtractor.
Do you have a sample file you could share? A PDF that triggers the slowdown
would let us add a regression test. A minimal or synthetic file is fine, for
example one content stream that shows the same character many times. If you
can't share one, a short description of how to generate it also helps.
> Marked-content extractor compares every glyph with all earlier ones and never
> resets, so crafted PDFs can hang it
> ------------------------------------------------------------------------------------------------------------------
>
> Key: PDFBOX-6353
> URL: https://issues.apache.org/jira/browse/PDFBOX-6353
> Project: PDFBox
> Issue Type: Bug
> Reporter: Simon Steiner
> Priority: Major
>
> PDFMarkedContentExtractor is a public PDFBox class for pulling tagged
> (marked) content out of PDF pages. To drop overlapping duplicate glyphs,
> processTextPosition keeps every glyph seen so far in the instance field
> characterListMapping, keyed by its Unicode string. It checks each new glyph
> against every earlier glyph with the same string, one by one. Duplicate
> suppression is on by default (suppressDuplicateOverlappingText = true). The
> list is never cleared, neither per page nor per document, and nothing limits
> its size. So a content stream that shows one character many times at
> different positions costs work that grows with the square of the glyph count.
> A reused instance also keeps all earlier glyphs in memory and wrongly drops
> text on later pages or documents that sits at the same position as identical
> earlier text.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]