officefileapi-devexpress-dot-docs-dot-presentation-dot-export-dot-pdfexportoptions-2f6b9240.md
Obtains a list of PDF file attachments.
Namespace : DevExpress.Docs.Presentation.Export
Assembly : DevExpress.Docs.Presentation.v25.2.dll
NuGet Package : DevExpress.Docs.Presentation
public ICollection<Attachment> Attachments { get; }
Public ReadOnly Property Attachments As ICollection(Of Attachment)
| Type | Description |
|---|---|
| ICollection<Attachment> |
A list of attached files.
|
The following code snippet attaches a PDF file to the exported presentation:
using DevExpress.Docs.Pdf;
using DevExpress.Docs.Presentation;
using DevExpress.Docs.Presentation.Export;
//...
using (var presentation = new Presentation(File.ReadAllBytes(@"C:\Documents\Presentation.pptx")))
{
var attachment = new Attachment();
attachment.Data = File.ReadAllBytes(@"C:\Documents\test.pdf");
attachment.Relationship = AttachmentRelationship.Supplement;
attachment.FileName = "attachment.pdf";
attachment.CreationDate = DateTime.Now;
attachment.Type = "application/pdf";
PdfExportOptions options = new PdfExportOptions();
options.Attachments.Add(attachment);
presentation.ExportToPdf(new FileStream("C:\\Documents\\Presentation.pdf", FileMode.Create, FileAccess.ReadWrite), options);
}
Imports DevExpress.Docs.Pdf
Imports DevExpress.Docs.Presentation
Imports DevExpress.Docs.Presentation.Export
'...
Using presentation = New Presentation(File.ReadAllBytes("C:\Documents\Presentation.pptx"))
Dim attachment = New Attachment()
attachment.Data = File.ReadAllBytes("C:\Documents\test.pdf")
attachment.Relationship = AttachmentRelationship.Supplement
attachment.FileName = "attachment.pdf"
attachment.CreationDate = Date.Now
attachment.Type = "application/pdf"
Dim options As New PdfExportOptions()
options.Attachments.Add(attachment)
presentation.ExportToPdf(new FileStream("C:\Documents\Presentation.pdf", FileMode.Create, FileAccess.ReadWrite), options)
End Using
See Also