cete.dynamicpdf.documentpackage
DocumentPackage
- Namespace: ceTe.DynamicPDF
- Assemblies: DynamicPDF.NETFramework40.dll, DynamicPDF.NETStandard20.dll
Represents a package PDF.
public class DocumentPackage : Resource
Public Class DocumentPackage
Inherits Resource
Inheritance: Object → Resource → DocumentPackage
Licensing
This class is a DynamicPDF Generator Professional Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Professional Edition
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Professional Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Professional Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Professional Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
Examples
This example shows how to create a package PDF.
Imports System
Imports System.IO
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.IO
Module MyModule
Sub Main()
' Create a PDF document.
Dim MyDocument As Document = New Document
' File streams used for creating the instance of embedded file.
Dim fileStream1 As FileStream = New FileStream("C:\DocumentA.pdf",FileMode.Open,FileAccess.Read,FileShare.ReadWrite)
Dim fileStream2 As FileStream = New FileStream("C:\DocumentB.pdf",FileMode.Open,FileAccess.Read,FileShare.ReadWrite)
' Byte array of the file by reading the file.
Dim filebyte(fileStream2.Length) As byte
fileStream2.Read(filebyte, 0, filebyte.Length )
' Create 3 instances of embedded file using all the available constructors.
Dim embeddedFile1 As EmbeddedFile = New EmbeddedFile("C:\DocumentC.pdf")
Dim embeddedFile2 As EmbeddedFile = New EmbeddedFile( fileStream1, "DocumentA.pdf", DateTime.Now )
Dim embeddedFile3 As EmbeddedFile = New EmbeddedFile( filebyte, "DocumentB.pdf", DateTime.Now )
' Add the embedded files to the embedded file list.
MyDocument.EmbeddedFiles.Add( embeddedFile1 )
MyDocument.EmbeddedFiles.Add( embeddedFile2 )
MyDocument.EmbeddedFiles.Add( embeddedFile3 )
' Create a page and add it to the document.
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a document package with attachment layout detailed.
MyDocument.Package = New DocumentPackage(AttachmentLayout.Detailed)
' Add a label to the page.
MyPage.Elements.Add(New Label("This is a Cover page for Package PDF", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center))
' Save the PDF document.
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string inputPathPdfA, string inputPathPdfB, string inputPathPdfC, string outputPath)
{
// Create a PDF document.
Document document = new Document();
// File streams used for creating the instance of embedded file.
FileStream fileStream1 = new FileStream(inputPathPdfA,FileMode.Open,FileAccess.Read,FileShare.ReadWrite); FileStream fileStream2 = new FileStream(inputPathPdfB,FileMode.Open,FileAccess.Read,FileShare.ReadWrite);
// Byte array of the file by reading the file.
byte[] filebyte = new byte[fileStream2.Length];
fileStream2.Read(filebyte, 0, filebyte.Length );
// Create 3 instances of embedded file using all the available constructors.
EmbeddedFile embeddedFile1 = new EmbeddedFile(inputPathPdfC);
EmbeddedFile embeddedFile2 = new EmbeddedFile( fileStream1, "DocumentA.pdf", DateTime.Now );
EmbeddedFile embeddedFile3 = new EmbeddedFile( filebyte, "DocumentB.pdf", DateTime.Now );
// Add the embedded files to the embedded file list.
document.EmbeddedFiles.Add( embeddedFile1 );
document.EmbeddedFiles.Add( embeddedFile2 );
document.EmbeddedFiles.Add( embeddedFile3 );
// Create a page and add it to the document.
Page page = new Page();
document.Pages.Add( page );
// Create a document package with attachment layout detailed.
document.Package = new DocumentPackage(AttachmentLayout.Detailed);
// Add a label to the page
page.Elements.Add( new Label("This is a Cover page for Package PDF", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center ) );
// Save the PDF document
document.Draw( outputPath );
}
}
Constructors
DocumentPackage()
Initializes a new instance of the DocumentPackage class.
public DocumentPackage()
Public Sub New ()
DocumentPackage(AttachmentLayout)
Initializes a new instance of the DocumentPackage class with the specified attachment layout type.
public DocumentPackage(AttachmentLayout layout)
Public Sub New (layout As AttachmentLayout)
Parameters
- layout: AttachmentLayout
Properties
AscendingOrder
Gets or sets a boolean which specifies the ordering in ascending or descending. Default value is true(Ascending order).
public bool AscendingOrder { get; set; }
Public Property AscendingOrder As Boolean
Property Value
OrderBy
Gets or sets the listing order by using the specified AttachmentListingOrderBy enum element.
public AttachmentListingOrderBy OrderBy { get; set; }
Public Property OrderBy As AttachmentListingOrderBy
Property Value
RequiredPdfObjects
Gets the number of PDF objects required by the resource.
public int RequiredPdfObjects { get; }
Public Property RequiredPdfObjects As Int32
Property Value
ResourceType
Gets the type of resource. (Inherited from Resource)
public ResourceType ResourceType { get; }
Public Property ResourceType As ResourceType
Property Value
Uid
Gets the unique ID of the resource. (Inherited from Resource)
public long Uid { get; }
Public Property Uid As Int64
Property Value
ViewList
Gets or sets the AttachmentLayout . Default is detailed layout.
public AttachmentLayout ViewList { get; set; }
Public Property ViewList As AttachmentLayout
Property Value
Methods
Draw(DocumentWriter)
Draws the resource to the given DocumentWriter object.
public void Draw(DocumentWriter writer)
Sub Draw(writer As DocumentWriter)
Parameters
- writer: DocumentWriter
DocumentWriter object to receive the resource's output.
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
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
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 .