PdfCustomMetadata
6 Jul 20262 minutes to read
Represents the custom metadata for a PDF document.
Provides methods to manage key-value metadata pairs.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access the document properties
let documentProperties: PdfDocumentProperites = document.getDocumentInformation(false);
// Gets the custom metadata
let custom: PdfCustomMetadata = documentProperties.customMetadata;
// Sets custom value
custom.set('key','value');
// Sets the document Information
document.setDocumentInformation(documentProperties);
// Saves the document
document.save();Methods
get
Gets a key from the custom data map.
| Parameter | Type | Description |
|---|---|---|
| key | string |
The key to get. |
Returns string
has
Checks whether a key exists in the custom data map.
| Parameter | Type | Description |
|---|---|---|
| key | string |
The key to check. |
Returns boolean
remove
Removes a key from the custom data map.
| Parameter | Type | Description |
|---|---|---|
| key | string |
The key to remove. |
Returns void
set
Sets a key to the custom data map.
| Parameter | Type | Description |
|---|---|---|
| key | string |
The metadata key. |
| value | string |
The metadata value. |
Returns void