Document.Draw

Overloads

Draw()Outputs the generated Document to a byte array.
Draw(Stream)Outputs the generated Document to the given Stream object.
Draw(String)Outputs the generated Document to a file.

Draw()

Outputs the generated Document to a byte array.

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

Returns

Byte[]

Licensing Info

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

Examples

This example shows how to output the PDF to a byte array.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.PageElements.Html
     
Module MyModule
     
    Sub Main()
      
	  'Create a PDF Document
        Dim document As Document = New Document

        'Create a Page and add it to the document
        Dim page As Page = New Page
        document.Pages.Add(page)

        ' Add a label to the page 
        page.Elements.Add(New Label("My PDF Document", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center))

        'Save the PDF document to a byte array
        Dim pdfData() As Byte = document.Draw()
	             
    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
     public static void CreatePDF()
     {
         // Create a PDF Document
         Document document = new Document();

         // Create a Page and add it to the document
         Page page = new Page();
         document.Pages.Add(page);

         // Add a label to the page 
         page.Elements.Add(new Label("My PDF Document", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center));

         // Save the PDF document to a byte array
         byte[] pdfData = document.Draw();
     }
}

Draw(Stream)

Outputs the generated Document to the given Stream object.

public void Draw(Stream stream)
public Sub Draw(stream As Stream)

Parameters

stream
Stream

Stream object that receive the Document output.

Licensing Info

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

Examples

This example shows how to output the document to a memory stream object.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Imports ceTe.DynamicPDF.PageElements.Html
     
Module MyModule
     
    Sub Main()
      
	   'Create a PDF Document
        Dim document As Document = New Document

        'Create a Page and add it to the document
        Dim page As Page = New Page
        document.Pages.Add(page)

        ' Add a label to the page 
        page.Elements.Add(New Label("My PDF Document", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center))

        'Create a memory stream object to save to
        Dim outputStream As MemoryStream = New MemoryStream

        ' Output the PDF to the MemoryStream
        document.Draw(outputStream)
	  	             
    End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example
{
     public static void CreatePDF()
     {
         // Create a PDF Document
         Document document = new Document();

         // Create a Page and add it to the document
         Page page = new Page();
         document.Pages.Add(page);

         // Add a label to the page 
         page.Elements.Add(new Label("My PDF Document", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center));

         // Create a memory stream object to save to
         MemoryStream outputStream = new MemoryStream();

         // Output the PDF to the MemoryStream
         document.Draw(outputStream);
     }
}

Draw(String)

Outputs the generated Document to a file.

public void Draw(string filePath)
public Sub Draw(filePath As String)

Parameters

filePath
String

File path to store the Document.

Licensing Info

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

Examples

This example shows how to output the PDF to a file.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
     
Module MyModule
     
    Sub Main()

	 'Create a PDF Document
        Dim document As Document = New Document

        ' Add a page and add it to the document
        Dim page As Page = New Page
        document.Pages.Add(page)

        ' Add a label to the page 
        page.Elements.Add(New Label("My PDF Document", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center))

        ' Save the PDF document
        document.Draw(outputPath)

    End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;

public class Example 
{
    public static void CreatePDF(string outputPath)
    {
        // Create a PDF Document
        Document document = new Document();

        // Create a Page and add it to the document
        Page page = new Page();
        document.Pages.Add( page );

        // Add a label to the page 
        page.Elements.Add( new Label( "My PDF Document", 0, 0, 512, 40, Font.Helvetica, 30, TextAlign.Center ) );

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

See Also

Document
ceTe.DynamicPDF

In this topic