StitchPageOverlay
Page manipulation
Description
Overlays one page's content onto another existing page at the given position. The source page is captured into a vector Form XObject and drawn on the target page, preserving full vector fidelity (text stays selectable, paths stay crisp) rather than rasterizing.
The source page is consumed in the process: it is captured and hidden, exactly like ImposePagesNUp. If the target page number is greater than the source page number, it is automatically adjusted because hiding the source shifts later pages down by one.
The Width and Height control the placement size; if their aspect ratio differs from the source page, the content is stretched. Use the page's own dimensions for a 1:1 overlay. Opacity ranges from 0 (fully transparent) to 1 (fully opaque).
Syntax
Delphi
Function TPDFlib.StitchPageOverlay(SourcePage, TargetPage: Integer; Left, Top, Width, Height, Opacity: Double): Integer;
Parameters
| SourcePage | The 1-based page number whose content will be captured and overlaid (consumed and hidden afterwards) |
|---|---|
| TargetPage | The 1-based page number that receives the overlay; must differ from SourcePage |
| Left, Top | Top-left placement of the overlaid content on the target page, in current measurement units (top-left origin) |
| Width, Height | Placement size; pass the source page dimensions for unscaled overlay |
| Opacity | 0..1 alpha for the overlaid content (1 = opaque, values below 1 enable transparency via ExtGState ca/CA) |
Return values
| 0 | The overlay could not be performed (invalid page numbers, same source and target, or capture failure) |
|---|---|
| 1 | The source page was captured and overlaid onto the target page |