function SaveAsWithAssociateFiles(const FileName: string; const Options: TAssocFilesOptions): Boolean;
| FileName | string. The target output file path |
| Options | TAssocFilesOptions. Injection options detailing files, metadata, and the target catalog or page attachment point |
True if the PDF with injected associate files was successfully saved, or False on failureSaveAsWithAssociateFiles implements PDF 2.0 Associate Files injection (ISO 32000-2 §7.11.4)
The method attaches files such as XML data, source schemas, or templates to the catalog or individual pages with explicit /AFRelationship metadata
TAssociateFile.Description writes the human-readable file-specification /Desc value used by accessibility and discovery workflows
saRemoveSecurity)TAssocFilesOptions structure, specifying filenames, content arrays, MIME types, and relationships
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;