StitchPagesVertically

Page manipulation

Description

Stacks a sequence of pages vertically into a single new, tall page (poster-style composition). Every source page is captured into a vector Form XObject and drawn top-to-bottom, each scaled to TargetWidth while preserving its aspect ratio, with a Gap inserted between consecutive pages.

Pages are captured in descending page-number order so earlier page indexes stay stable as later pages are hidden. The new page's height is automatically computed as the sum of all scaled source heights plus Gap times (count - 1). All source pages are consumed and hidden.

Syntax

Delphi

Function TPDFlib.StitchPagesVertically(Const PageRanges: WideString; Gap, TargetWidth: Double): Integer;

Parameters

PageRangesA standard page-range string (e.g. "1-3,5"); empty means all pages
GapVertical space inserted between consecutive pages, in current measurement units
TargetWidthThe width of the new output page; each source page is scaled (preserving aspect ratio) to this width

Return values

0The stitch could not be performed (empty range, non-positive TargetWidth, or capture failure)
>= 1The 1-based page number of the newly created vertical-stitch page