PDFium Delphi Component Docs

Phương thức SaveAsWithAssociateFiles

Component: TPdf  ·  Unit: PDFium
Lưu PDF đang hoạt động vào đường dẫn tệp trong khi đưa các tệp liên kết vào catalog hoặc các trang tuân thủ ISO 32000-2 §7.11.4

Syntax

function SaveAsWithAssociateFiles(const FileName: string; const Options: TAssocFilesOptions): Boolean;

FileNamestring. Đường dẫn tệp xuất đích
OptionsTAssocFilesOptions. Các tùy chọn chèn chi tiết hóa tệp, siêu dữ liệu và điểm đính kèm catalog hoặc trang đích

Return Value

Trả về True nếu PDF với các tệp liên kết được chèn đã được lưu thành công, hoặc False khi thất bại

Description

SaveAsWithAssociateFiles triển khai tính năng chèn tệp liên kết (Associate Files) của PDF 2.0 (ISO 32000-2 §7.11.4)

Phương thức đính kèm các tệp như dữ liệu XML, schema nguồn hoặc template vào catalog hoặc từng trang riêng lẻ với siêu dữ liệu /AFRelationship tường minh

TAssociateFile.Description ghi giá trị /Desc của đặc tả tệp ở dạng người đọc được, dùng bởi các luồng công tác trợ năng và khám phá

Remarks

Example

var
  Opts: TAssocFilesOptions;
  F: TAssociateFile;
begin
  Opts := TAssocFilesOptions.Default;
  Opts.TargetPage := 0; // catalog-level attachment

  F.FileName := 'data.xml';
  F.Description := 'Source data for this document';
  F.Content := GetXmlBytes;
  F.Relationship := afData;
  F.MIMEType := 'text/xml';

  SetLength(Opts.Files, 1);
  Opts.Files[0] := F;

  if Pdf1.SaveAsWithAssociateFiles('output.pdf', Opts) then
    ShowMessage('PDF with associate files saved successfully');
end;

See Also

SaveAsWithAssociateFilesToStream, SaveAs