AddPageAssociatedFileFromString

Embedded files

Description

Binds an embedded file built from a string to one page's /AF array

Syntax

Delphi

Function AddPageAssociatedFileFromString(PageNumber: Integer; Const Source, DisplayName, MIMEType, Description, Relationship: WideString): Integer;

Return values

0Validation failed: no document, empty source or display name, duplicate embedded-file title, invalid relationship, or a PDF/A mode that forbids arbitrary attachments
RefHandle of the new file specification object

Remarks

The payload is stored exactly like AddAssociatedFileFromString and registered in the EmbeddedFiles name tree, but the /AF association is written into the page dictionary instead of the document catalog so the binding survives save and load round trips. Relationship must be one of Source, Data, Alternative, Supplement or Unspecified. Writing a page /AF array raises the document to PDF 2.0.

Example

PDF.AddPageAssociatedFileFromString(1, XML, "page-data.xml", "text/xml", "Page payload", "Source");

See also

AddAssociatedFileFromString, GetAssociatedFileCount