ApplyRepeatedPageFragment

Page layout, Tagged PDF, Performance

Description

Places one captured Form XObject on every selected page while marking each placement as an artifact outside the logical structure tree

The captured stream and its resources are shared by all placements, avoiding repeated construction of identical headers, group labels, backgrounds, folios, watermarks, or decorative fragments

Syntax

Delphi

Function TPDFlib.ApplyRepeatedPageFragment(CaptureID: Integer;
  Const PageRange: WideString; Left, Top, Width, Height: Double;
  Const ArtifactType, ArtifactSubtype: WideString): Integer;

ActiveX

Function PDFlib::ApplyRepeatedPageFragment(CaptureID As Long,
  PageRange As String, Left As Double, Top As Double, Width As Double,
  Height As Double, ArtifactType As String,
  ArtifactSubtype As String) As Long

DLL

int DLApplyRepeatedPageFragment(int InstanceID, int CaptureID,
  const wchar_t* PageRange, double Left, double Top, double Width,
  double Height, const wchar_t* ArtifactType,
  const wchar_t* ArtifactSubtype);
int DLApplyRepeatedPageFragmentA(int InstanceID, int CaptureID,
  const char* PageRange, double Left, double Top, double Width,
  double Height, const char* ArtifactType,
  const char* ArtifactSubtype);

Parameters

CaptureIDA reusable capture returned by EndFormXObject or another Form capture API in the current document
PageRangeA page-range expression, or an empty string for every page
Left, Top, Width, HeightPlacement rectangle passed to DrawCapturedPage; coordinates must be finite and dimensions must be positive
ArtifactTypeOne of Pagination, Layout, Page, or PDF 2.0 Background
ArtifactSubtypeEmpty unless ArtifactType is Pagination; accepted standard values are Header, Footer, Watermark, PageNum, LineNum, Redaction, and Bates

Return values

Returns the number of pages on which the fragment was placed, or 0 when validation fails, the range is empty, or the current API scope cannot change pages

Remarks

The function preserves the caller's selected page and painter state

Background, PageNum, LineNum, Redaction, and Bates raise the output feature version to PDF 2.0

Repeated placements are always artifacts; draw a separate semantic occurrence outside this call when the first occurrence belongs in the reading order

Example

PDF.BeginFormXObject(0, 0, 180, 24);
PDF.PrintText(0, 8, 'Confidential draft');
FragmentID:= PDF.EndFormXObject;

if PDF.ApplyRepeatedPageFragment(FragmentID, '2-end', 36, 806,
  180, 24, 'Pagination', 'Header')= 0 then
  HandleLayoutError;