officefileapi-devexpress-dot-pdf-dot-pdffileattachment-fbc4a32e.md
Gets or sets the relationship between the document and the attachment file.
Namespace : DevExpress.Pdf
Assembly : DevExpress.Pdf.v25.2.Core.dll
NuGet Package : DevExpress.Pdf.Core
public PdfAssociatedFileRelationship Relationship { get; set; }
Public Property Relationship As PdfAssociatedFileRelationship
| Type | Description |
|---|---|
| PdfAssociatedFileRelationship |
A PdfAssociatedFileRelationship enumeration value that specifies the relationship between the document and the attachment file.
|
Available values:
| Name | Description |
|---|---|
| Source |
The attached file has the original source material for the associated content.
| | Data |
The attached file represents information used to derive a visual presentation (e.g. for a table or a graph).
| | Alternative |
The attached file specification has an alternative representation of the content (e.g., audio).
| | Supplement |
The attached file represents a supplemental representation of the original source or data.
| | EncryptedPayload |
The file specification is an encrypted payload document that should be displayed to the user if the PDF Document Processor has the cryptographic filter needed to decrypt the document.
| | Unspecified |
The relationship is unknown or does not match any relationship above.
|
using DevExpress.Pdf;
using System;
using System.IO;
using (PdfDocumentProcessor processor = new PdfDocumentProcessor())
{
// Load a document.
processor.LoadDocument("..\\..\\Document.pdf");
// Attach a file to the PDF document.
processor.AttachFile(new PdfFileAttachment() {
CreationDate = DateTime.Now,
Description = "This is my attached file.",
FileName = "MyAttach.txt",
Data = File.ReadAllBytes("..\\..\\..\\FileToAttach.txt"),
MimeType = "text/plain",
Relationship = PdfAssociatedFileRelationship.Supplement,
});
// The attached document.
processor.SaveDocument("..\\..\\Result.pdf");
}
Imports DevExpress.Pdf
Imports System
Imports System.IO
Shared Sub Main(ByVal args() As String)
Using processor As New PdfDocumentProcessor()
' Load a document.
processor.LoadDocument("..\..\Document.pdf")
' Attach a file to the PDF document.
processor.AttachFile(New PdfFileAttachment() With { _
.CreationDate = Date.Now, _
.Description = "This is my attached file.", _
.FileName = "MyAttach.txt", _
.Data = File.ReadAllBytes("..\..\FileToAttach.txt"), _
.MimeType = "text/plain",
.Relationship = PdfAssociatedFileRelationship.Supplement
})
' The attached document.
processor.SaveDocument("..\..\Result.pdf")
End Using
End Sub
See Also