DocumentPackage

Represents a package PDF.

public class DocumentPackage : Resource
Public Class DocumentPackage
    Inherits Resource

Inheritance: ObjectResourceDocumentPackage

Licensing Info

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

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.
DocumentPackage(AttachmentLayout)Initializes a new instance of the DocumentPackage class with the specified attachment layout type.

Properties

AscendingOrderGets or sets a boolean which specifies the ordering in ascending or descending. Default value is true(Ascending order).
OrderByGets or sets the listing order by using the specified AttachmentListingOrderBy enum element.
RequiredPdfObjectsGets the number of PDF objects required by the resource.
ResourceTypeGets the type of resource.
(Inherited from Resource)
UidGets the unique ID of the resource.
(Inherited from Resource)
ViewListGets or sets the AttachmentLayout . Default is detailed layout.

Methods

Draw(DocumentWriter)Draws the resource to the given DocumentWriter object.
Equals(Object)Determines whether the specified Object is equal to the current Object .
(Inherited from Object)
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

In this topic