Attachment

Represents a Attachments present in PDFDocument

public class Attachment
Public Class Attachment

Inheritance: ObjectAttachment

Licensing Info

This class is a DynamicPDF Core Suite Essentials feature. One of the following is required for non-evaluation usage:

Examples

The following examples retrieves the attachment files in the PDFDocument.
Imports System
Imports System.IO;
Imports System.Collections.Generic;
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.Merger
 
Module MyModule
 
    Sub Main()
 
        ' Create PDF document object
        Dim pdfA As PdfDocument = New PdfDocument("C:\ImportPDF.pdf")
 
        ' Merge the PDF document
        Dim MyDocument As MergeDocument = New MergeDocument(pdfA)
 
        ' Getting the AttachmentFiles present in PDFDocument
        Dim attachments As Attachment() = pdfA.Attachments()

        ' Looping through the files to get Attachment Files present
        For Each file As ceTe.DynamicPDF.Merger.Attachment In attachments
            Dim file1 As Byte() = file.GetData()
            File.WriteAllBytes(file.Filename, file1)
        Next
            
        ' Save the PDF
        MyDocument.Draw("C:\MyDocument.pdf")
 		
    End Sub
End Module
using System;
using System.IO;
using System.Collections.Generic;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.Merger;

public class Example
{
    public static void CreatePDF(string outputPath, string inputFilePath)
    {
        // Create PDF document object
        PdfDocument pdfA = new PdfDocument(inputFilePath);

        // Merge the PDF document
        MergeDocument mergeDocument = new MergeDocument(pdfA);

        // Getting the AttachmentFiles present in PDFDocument
        Attachment[] attachments = pdfA.Attachments();

        // Looping through the files to get Attachment Files present
        foreach (Attachment file in attachments)
        {
            byte[] file1 = file.GetData();
            File.WriteAllBytes(file.Filename, file1);
        }

        // Save the PDF
        mergeDocument.Draw(outputPath);
    }
}

Remarks

This class should be used when you want to get the attachment files present in an pdf document

Properties

FilenameGets the Filenames of the Attachment Files present in PDFDocument.
MimeTypeGets the Filenames of the Attachment Files present in PDFDocument.

Methods

Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
GetData()Gets the Data of the Attachment Files.
GetHashCode()Serves as a hash function for a particular type.
(Inherited from Object)
GetType()Gets the Type of the current instance.
(Inherited from Object)
ToString()Returns a String that represents the current Object .
(Inherited from Object)

See Also

ceTe.DynamicPDF.Merger

In this topic