Export the XFA/StructTree-layers in the viewer components #13942
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
While e.g. the
simpleviewer
andsinglepageviewer
examples work, since they're based on theBaseViewer
-class, the standalonepageviewer
example currently doesn't support either XFA- or StructTree-layers. This seems like an obvious oversight, which can be easily addressed simply by exporting the necessary functionality throughpdf_viewer.component.js
, similar to the existing Text/Annotation-layers.While working on, and testing, these changes I happened to notice a number of smaller things that's also fixed in this patch:
Ensure that
XfaLayerBuilder.render
always have a consistent return type, to prevent possible run-time failures inPDFPageView
; PR [api-minor] XFA - Support text search in XFA documents. #13908 follow-up.Change the order of the options in the
XfaLayerBuilder
-constructor to agree with the parameter order in theDefaultXfaLayerFactory.createXfaLayerBuilder
-method.Add a missing
textHighlighterFactory
-option, in the JSDocs for thePDFPageView
-class.A couple of small tweaks in the
TextLayerBuilder.render
-method: Re-use an existing Array rather than creating a new one, and replace anif
with optional chaining instead.Please note: For now XFA-support is currently disabled by default, similar to the regular viewer.