ApplyRepeatedPageFragment

页面版面、标记 PDF、性能

描述

在每个所选页面上放置一个已捕获的 Form XObject,同时把每个放置标记为逻辑结构树之外的工件

已捕获的流及其资源被所有放置共享,避免重复构建相同的页眉、组标签、背景、页码、水印或装饰片段

语法

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);

参数

CaptureID由 EndFormXObject 或当前文档中其他 Form 捕获 API 返回的可复用捕获
PageRange页面范围表达式,或表示所有页面的空字符串
Left, Top, Width, Height传递给 DrawCapturedPage 的放置矩形;坐标必须有限且尺寸必须为正
ArtifactTypePagination、Layout、Page 或 PDF 2.0 的 Background 之一
ArtifactSubtype除非 ArtifactType 为 Pagination,否则为空;接受的标准值为 Header、Footer、Watermark、PageNum、LineNum、Redaction 和 Bates

返回值

返回放置了片段的页面数量;验证失败、范围为空或当前 API 作用域无法更改页面时返回 0

备注

该函数保留调用方的所选页面与画笔状态

Background、PageNum、LineNum、Redaction 和 Bates 会把输出功能版本提升到 PDF 2.0

重复放置始终是工件;若首次出现应进入阅读顺序,请在此调用之外单独绘制语义上的出现

示例

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;