PdfPortfolio Class

A portfolio (/Collection, ISO 32000-2, 12.3.5): a document whose embedded files viewers show as a list, with the fields of a schema, sorted and in folders. The files are the embedded files of the document (PdfDocument.EmbeddedFiles), and their values are set with PdfEmbeddedFile.SetPortfolioValue.

public sealed class PdfPortfolio

Properties

NameDescription
DictionaryGets the collection dictionary.
FieldsGets the fields of the schema (/Schema), in their order (PdfPortfolioField.Order, then the order of the dictionary).
InitialFileGets or sets the name of the embedded file viewers show first (/D): its key in PdfDocument.EmbeddedFiles, or null for the document itself.
RootFolderGets the root of the folders (/Folders), or null when the files are not in folders.
SortAscendingGets a value indicating whether the files are sorted in ascending order of the first field (/Sort /A, the default).
SortFieldsGets the keys of the fields the files are sorted by (/Sort /S), the first one first.
ViewGets or sets how viewers show the files (/View).

Dictionary

PdfPortfolio.cs

Gets the collection dictionary.

public PdfDictionary Dictionary { get; }

Property value

PdfDictionary

Gets the fields of the schema (/Schema), in their order (PdfPortfolioField.Order, then the order of the dictionary).

public IReadOnlyList<PdfPortfolioField> Fields { get; }

InitialFile

PdfPortfolio.cs

Gets or sets the name of the embedded file viewers show first (/D): its key in PdfDocument.EmbeddedFiles, or null for the document itself.

public string? InitialFile { get; set; }

Property value

string?

RootFolder

PdfPortfolio.cs

Gets the root of the folders (/Folders), or null when the files are not in folders.

public PdfPortfolioFolder? RootFolder { get; }

Property value

PdfPortfolioFolder?

SortAscending

PdfPortfolio.cs

Gets a value indicating whether the files are sorted in ascending order of the first field (/Sort /A, the default).

public bool SortAscending { get; }

Property value

bool

SortFields

PdfPortfolio.cs

Gets the keys of the fields the files are sorted by (/Sort /S), the first one first.

public IReadOnlyList<string> SortFields { get; }

Property value

IReadOnlyList<string>

Gets or sets how viewers show the files (/View).

public PdfPortfolioView View { get; set; }

Property value

PdfPortfolioView

Methods

NameDescription
AddField(string, string, PdfPortfolioFieldType)Adds a field to the schema, or replaces the field of the same key.
SetSort(bool, IEnumerable<string>)Sets the fields the files are sorted by (/Sort).

AddField(string, string, PdfPortfolioFieldType)

PdfPortfolio.cs

Adds a field to the schema, or replaces the field of the same key.

Parameters

key string
The key of the field: the name of its values in the files.
name string
The name viewers show for the field.
type PdfPortfolioFieldType
The type of the values.

Returns

PdfPortfolioField The field. Its order is after the fields of the schema.

Exceptions

ArgumentException
key is empty.

SetSort(bool, IEnumerable<string>)

PdfPortfolio.cs

Sets the fields the files are sorted by (/Sort).

public void SetSort(bool ascending, params IEnumerable<string> keys)

Parameters

ascending bool
Whether the files are sorted in ascending order.
keys IEnumerable<string>
The keys of the fields, the first one first; none removes the sort.