Skip to main content

Attachment

Version: 10.0

cete.dynamicpdf.merger.attachment

Attachment​

Represents a Attachments present in PDFDocument

public class Attachment
Public Class Attachment

Inheritance: Object → Attachment

Licensing​

This class is a DynamicPDF Merger Standard Edition feature. One of the following licenses is required for non-evaluation usage:

  • DynamicPDF Merger for .NET Standard Edition
  • DynamicPDF Merger for .NET Professional Edition
  • DynamicPDF Merger for .NET Enterprise Edition
  • DynamicPDF Core Suite for .NET Professional Edition
  • DynamicPDF Core Suite for .NET Enterprise Edition

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​

Filename​

Gets the Filenames of the Attachment Files present in PDFDocument.

public string Filename { get; set; }
Public Property Filename As String

Property Value​

String

MimeType​

Gets the Filenames of the Attachment Files present in PDFDocument.

public string MimeType { get; }
Public Property MimeType As String

Property Value​

String

Methods​

Equals(Object)​

Determines whether the specified Object is equal to the current Object . (Inherited from Object)

public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean

Parameters​

The Object to compare with the current Object .

Returns​

true if the specified Object is equal to the current Object ; otherwise, false.

GetData()​

Gets the Data of the Attachment Files.

public Byte[] GetData()
Function GetData() As Byte()

Returns​

Contains the byte array of Attachment files

GetHashCode()​

Serves as a hash function for a particular type. (Inherited from Object)

public int GetHashCode()
Function GetHashCode() As Integer

Returns​

A hash code for the current Object .

GetType()​

Gets the Type of the current instance. (Inherited from Object)

public Type GetType()
Function GetType() As Type

Returns​

The Type instance that represents the exact runtime type of the current instance.

ToString()​

Returns a String that represents the current Object . (Inherited from Object)

public string ToString()
Function ToString() As String

Returns​

A String that represents the current Object .

See Also​

ceTe.DynamicPDF.Merger