Pdf - PdfAttachmentRelationship

18 Nov 20261 minute to read

Specifies the relationship of an embedded file attachment to the PDF document content.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Create a new attachment
let attachment: PdfAttachment = new PdfAttachment(attachmentData, 'input.txt');
// Set the relationship
attachment.relationship = PdfAttachmentRelationship.Data;
// Add the attachment to the document
document.attachments.add(attachment);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • Alternative - An alternative representation of the PDF contents.
  • Data - Information used to derive a visual presentation.
  • Source - The original source material for the associated content.
  • Supplement - A supplemental representation of the original source or data that may be more easily consumable.
  • Unspecified - The relationship is unknown or cannot be described using one of the other values.