SaveAllAttachmentsEx
Document properties, extraction
Description
Exports every document-level and annotation attachment under an explicit conflict policy
The optional resolver receives each attachment before writing and may change its leaf name, conflict policy or Save flag
All resolved names are sanitized after the callback, directory components are discarded and Windows reserved device names receive a leading underscore, including multi-extension names such as NUL.tar.gz and the superscript-digit variants of COM and LPT
Resolved leaf names are shortened to at most 240 UTF-16 code units before collision suffixes are added, without splitting a surrogate pair; trailing spaces and periods are removed again after shortening
Syntax
Delphi
Function TPDFlib.SaveAllAttachmentsEx(Const OutputDir: WideString;
ConflictPolicy: TPDFlibAttachmentConflictPolicy;
OnResolveName: TPDFlibAttachmentNameResolver): Integer;Parameters
| OutputDir | Destination directory, created recursively when missing; a trailing separator is optional |
|---|---|
| ConflictPolicy | Policy for targets that already exist or repeat within the export: acpOverwrite, acpSkip or acpRename |
| OnResolveName | Optional resolver called before each attachment is written; it may change the leaf name, override the conflict policy and set Save to False to drop the attachment. Nil keeps the supplied policy |
Conflict policies
| acpOverwrite | Write the requested target even when it already exists |
|---|---|
| acpSkip | Skip a target already present as a file or directory on disk, or selected earlier in the same export |
| acpRename | Add a numeric suffix until the target avoids existing files, directories and names selected earlier in the export |
Return values
Returns the number of attachment files successfully written