Class PdfOverlay
- java.lang.Object
-
- com.pd4ml.pdf.overlay.PdfOverlay
-
public final class PdfOverlay extends java.lang.ObjectComposites selected pages of one document (srcDoc) onto selected pages of another (destDoc) -- the engine behindcom.pd4ml.pdf.PdfDocumentBase#overlay/#underlay. Replaces the legacycom.pd4ml.pdf.parser.PdfDoc's own ~600-line per-operator content-stream/resource-merging engine with a simpler design: each distinct source page actually used is cloned once into a fully self-contained Form XObject (its own/BBox, its own deep-cloned/Resources-- viaCOSObjectImporter, which already deduplicates any resource shared across multiple cloned pages), so nothing here ever needs to merge or deduplicate two documents' resource dictionaries by hand the way the legacy engine did. Wiring per destination page is limited to: copy-on-write its own/Resources(and the/XObject//ExtGStatesub-dictionaries within it) only if not already page-owned, add one uniquely-named XObject (and, ifopacity<255, one ExtGState) entry, and splice one small new content-stream snippet into its/Contentsarray -- appended for overlay (drawn last, on top), prepended for underlay (drawn first, underneath) -- without ever touching the page's own existing content stream bytes.Destination-to-source page pairing is round-robin over the pages actually kept by each scope array (matches legacy's own
count % ovlCountpairing exactly)./Linkannotations are cloned across from each used source page (matching legacy's own annotation-copying scope -- no other subtype was ever carried over either).Deliberate deviations from legacy, documented rather than silently replicated: no page-position coordinate translation is applied (legacy sourced one from the *destination* document's own page-0 CropBox regardless of which destination page was actually being composited onto -- read as a latent quirk, not a real feature);
/Names/Dests-style named-destination bookkeeping is out of scope (irrelevant to page content compositing).
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidapply(COSDocument destDoc, COSDocument srcDoc, boolean[] destScope, boolean[] srcScope, int opacity, boolean underlay)
-
-
-
Method Detail
-
apply
public static void apply(COSDocument destDoc, COSDocument srcDoc, boolean[] destScope, boolean[] srcScope, int opacity, boolean underlay) throws PdfOverlayException
- Throws:
PdfOverlayException
-
-