Package com.pd4ml.pdf.xfdf.internal
Class AnnotationMapper
- java.lang.Object
-
- com.pd4ml.pdf.xfdf.internal.AnnotationMapper
-
public final class AnnotationMapper extends java.lang.ObjectMaps one PDF annotation dictionary to and from itsXfdfAnnotationform (ISO 19444-1 §6.4), covering every markup annotation subtype XFDF has an element for: Text, Link, FreeText, Line, Square, Circle, Polygon, PolyLine, Highlight, Underline, Squiggly, StrikeOut, Stamp, Caret, Ink, Popup, FileAttachment, Sound and Redact.Widgetis deliberately excluded -- form field annotations carry their value through<fields>instead (seeFieldMapper), never through<annots>.Not round-tripped (documented v1 scope boundaries, each because XFDF itself has no clean syntax for it or because implementing it well is a project of its own): a Link's
/Anavigation action (its<OnActivation>target is read on import for informational purposes only and never re-derived on export); a FreeText/Line's leader-line geometry (/LL//LLE//LLO); a Stamp's custom appearance bitmap (<imagedata>); and a FileAttachment/Sound's actual embedded bytes (only the file-specification metadata round-trips, not the data itself). None of these omissions corrupt anything they touch -- the annotation itself still imports/exports correctly, just without that one extra piece of unusual data.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapplyToCOS(XfdfAnnotation x, COSDictionary target, COSDocument targetDoc)Populates (or, for an already-populatedtargetpassed in by the caller's "update if exists" handling -- seeXfdfImporter-- re-populates)targetfromx.static booleanisSupportedSubtype(java.lang.String subtype)trueifsubtype(a PDF/Subtypename) has an XFDF representation this mapper handles.static XfdfAnnotationtoXfdf(COSDictionary annot, int pageIndex)
-
-
-
Method Detail
-
isSupportedSubtype
public static boolean isSupportedSubtype(java.lang.String subtype)
trueifsubtype(a PDF/Subtypename) has an XFDF representation this mapper handles.
-
toXfdf
public static XfdfAnnotation toXfdf(COSDictionary annot, int pageIndex)
-
applyToCOS
public static void applyToCOS(XfdfAnnotation x, COSDictionary target, COSDocument targetDoc)
Populates (or, for an already-populatedtargetpassed in by the caller's "update if exists" handling -- seeXfdfImporter-- re-populates)targetfromx.targetis expected to already be registered as an indirect object oftargetDoc(its/P,/NMidentity and page membership are the caller's responsibility; this only fills in the annotation's own visual/content properties).
-
-