AddCollectionFolder

Attachments, Document properties

Description

Creates a folder in the portfolio, together with any missing parent folders

Syntax

Delphi

Function TPDFlib.AddCollectionFolder(Const FolderPath: WideString): Integer;

Parameters

FolderPathFolder names separated by /, such as Contracts/2026

Return values

-1No document, an empty path or an empty folder name between two separators
> 0The ID of the last folder in the path

Remarks

Folders that already exist are reused, so calling the function again with the same path returns the same ID. Folder names are compared exactly, including case

Portfolio folders are a PDF 2.0 feature, so the document version is raised to 2.0. Use SetCollectionItemFolder to place an embedded file in a folder

Example

PDF.AddFileAttachment('contract.pdf', PDF.AddEmbeddedFile('contract.pdf', 'application/pdf'));
PDF.AddCollectionFolder('Contracts/2026');
PDF.SetCollectionItemFolder('contract.pdf', 'Contracts/2026');

See also

SetCollectionItemFolder, SetCollectionView, AddCollectionField