Skip to content

fix: Content returns the text of form XObjects - #97

Open
anaelorlinski wants to merge 1 commit into
ledongthuc:masterfrom
anaelorlinski:fix-content-form-xobjects
Open

anaelorlinski wants to merge 1 commit into
ledongthuc:masterfrom
anaelorlinski:fix-content-form-xobjects

Conversation

@anaelorlinski

Copy link
Copy Markdown

Content() had no case for Do, so text drawn inside a form XObject (form-field appearances, embedded diagrams, headers placed as forms) was missing. Do now interprets a form's content stream in a saved graphics state, with the form's /Matrix concatenated to the CTM and its own /Resources (or those of the painting stream; PDF 32000-1:2008 §8.10). Image XObjects are ignored as before; nesting is bounded by maxFormDepth since a form can paint itself.

Refs #67 (which covers GetPlainText; this is the Content() side). Tests build small PDFs in memory, like buildContentPDF.

Content had no case for the Do operator, so the text drawn inside a form
XObject (form-field appearances, embedded diagrams, headers placed as
forms) was missing from the page.

Do now interprets a form XObject's content stream in a saved graphics
state, with the form's /Matrix concatenated to the CTM and the form's
own /Resources (or, without them, those of the content stream painting
it; PDF 32000-1:2008 §8.10). Image XObjects are ignored as before.
Nesting is bounded by maxFormDepth since a form can paint itself.

Refs ledongthuc#67
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant