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 PdfPortfolioProperties
| Name | Description |
|---|---|
| Dictionary | Gets the collection dictionary. |
| Fields | Gets the fields of the schema (/Schema), in their order (PdfPortfolioField.Order, then the order of the dictionary). |
| InitialFile | Gets or sets the name of the embedded file viewers show first (/D): its key in PdfDocument.EmbeddedFiles, or null for the document itself. |
| RootFolder | Gets the root of the folders (/Folders), or null when the files are not in folders. |
| SortAscending | Gets a value indicating whether the files are sorted in ascending order of the first field (/Sort /A, the default). |
| SortFields | Gets the keys of the fields the files are sorted by (/Sort /S), the first one first. |
| View | Gets or sets how viewers show the files (/View). |
Dictionary
PdfPortfolio.csFields
PdfPortfolio.csGets the fields of the schema (/Schema), in their order (PdfPortfolioField.Order, then the order of the dictionary).
public IReadOnlyList<PdfPortfolioField> Fields { get; }Property value
InitialFile
PdfPortfolio.csGets 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
RootFolder
PdfPortfolio.csGets the root of the folders (/Folders), or null when the files are not in folders.
public PdfPortfolioFolder? RootFolder { get; }Property value
SortAscending
PdfPortfolio.csSortFields
PdfPortfolio.csGets the keys of the fields the files are sorted by (/Sort /S), the first one first.
public IReadOnlyList<string> SortFields { get; }Property value
View
PdfPortfolio.csGets or sets how viewers show the files (/View).
public PdfPortfolioView View { get; set; }Property value
Methods
| Name | Description |
|---|---|
| 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.csAdds a field to the schema, or replaces the field of the same key.
public PdfPortfolioField AddField(string key, string name, PdfPortfolioFieldType type = PdfPortfolioFieldType.Text)Parameters
keystring- The key of the field: the name of its values in the files.
namestring- The name viewers show for the field.
typePdfPortfolioFieldType- The type of the values.
Returns
PdfPortfolioField The field. Its order is after the fields of the schema.
Exceptions
ArgumentExceptionkeyis empty.
SetSort(bool, IEnumerable<string>)
PdfPortfolio.csSets the fields the files are sorted by (/Sort).
public void SetSort(bool ascending, params IEnumerable<string> keys)Parameters
ascendingbool- Whether the files are sorted in ascending order.
keysIEnumerable<string>- The keys of the fields, the first one first; none removes the sort.