ImportPageAsFormXObject
Page manipulation, Form XObjects
Description
Imports one page from any open document into the selected document as an independent reusable Form XObject and returns a captured-page handle
The source and target page trees remain unchanged, page content is decoded and compressed once, and every later placement writes only a resource reference and a Do operation
Cross-document imports copy the inherited resource closure and Form-compatible /Group, /Metadata, /PieceInfo and /LastModified entries while same-document imports reuse existing resource references
Syntax
Delphi
Function TPDFlib.ImportPageAsFormXObject(SourceDocumentID, SourcePage, Options: Integer): Integer;Parameters
| SourceDocumentID | The document handle returned by a document creation or load operation; it may identify the selected document |
|---|---|
| SourcePage | The one-based page number in the source document |
| Options | 0 uses the media box; 1 uses the crop box with media-box fallback; 2 uses the bleed box with crop and media fallback; 3 uses the trim box with crop and media fallback; 4 uses the art box with crop and media fallback |
Return values
| 0 | The document handle, page number or option was invalid, the selected box was unusable, or a referenced resource could not be imported |
|---|---|
| Non-zero | A captured-page handle accepted by the drawing and Form configuration functions |
Remarks
The selected page box becomes the Form bounding box and inherited page rotation is normalized into the Form matrix, including non-zero box origins
Annotations, form fields, thumbnails, page-tree links, navigation entries and structural parent numbers are not page graphics and are not imported
Call this function once and reuse the returned handle with DrawCapturedPage, DrawCapturedPageMatrix, DrawRotatedCapturedPage, NewTilingPatternFromCapturedPage, SetCapturedPageOptional or SetCapturedPageTransparencyGroup