Skip to main content

PdfRasterizer

Version: 4.0

cete.dynamicpdf.rasterizer.pdfrasterizer

PdfRasterizer​

Represents a PDF rasterizer.

public class PdfRasterizer : IDisposable
Public Class PdfRasterizer
Implements IDisposable

Inheritance: Object → PdfRasterizer

Implements: IDisposable

Licensing Info​

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

Examples​

This example demonstrates how to rasterize a PDF document.

Imports System
Imports ceTe.DynamicPDF.Rasterizer

Module MyModule

Sub Main()

' Create a PdfRasterizer object.
Dim rasterizer As PdfRasterizer = New PdfRasterizer("InputPdfFile.pdf")

' Save the image.
rasterizer.DrawToMultiPageTiff("Output.tif", TiffImageFormat.TiffWithLzw, ImageSize.Dpi72)

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

class MyClass
{
static void Main(string[] args)
{
// Create a PdfRasterizer object.
PdfRasterizer rasterizer = new PdfRasterizer("InputPdfFile.pdf");

// Save the image.
rasterizer.DrawToMultiPageTiff("Output.tif", TiffImageFormat.TiffWithLzw, ImageSize.Dpi72);
}
}

Constructors​

PdfRasterizer(InputPdf)​

Initializes a new instance of the PdfRasterizer class.

public PdfRasterizer(InputPdf inputPdf)
Public Sub New (inputPdf As InputPdf)

Parameters​

Represents an input PDF to rasterize.

Licensing Info​

This constructor is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

PdfRasterizer(InputPdf, Int32, Int32)​

Initializes a new instance of the PdfRasterizer class.

public PdfRasterizer(InputPdf inputPdf, int startPageNumber, int pageCount)
Public Sub New (inputPdf As InputPdf, startPageNumber As Integer, pageCount As Integer)

Parameters​

Represents an input PDF to rasterize.

Starting page number of the PDF to rasterize.

Total page count of the PDF to rasterize.

Licensing Info​

This constructor is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

PdfRasterizer(String)​

Initializes a new instance of the PdfRasterizer class.

public PdfRasterizer(string filePath)
Public Sub New (filePath As String)

Parameters​

Physical file path of the PDF to rasterize.

Licensing Info​

This constructor is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

PdfRasterizer(String, Int32, Int32)​

Initializes a new instance of the PdfRasterizer class.

public PdfRasterizer(string filePath, int startPageNumber, int pageCount)
Public Sub New (filePath As String, startPageNumber As Integer, pageCount As Integer)

Parameters​

Physical file path of the PDF to rasterize.

Starting page number of the PDF to rasterize.

Total page count of the PDF to rasterize.

Licensing Info​

This constructor is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

Properties​

BackgroundColor​

Gets or sets the background color of the output image. Page contents will be rendered on top of the specified background color.

public Color BackgroundColor { get; set; }
Public Property BackgroundColor As Color

Property Value​

Color

Licensing Info​

This property is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

Remarks​

Transparency is supported if RGBA color format is used. If color format is other than RGBA alpha value will be ignored. In case of Monocrome or Grayscale images, background color specified will be converted to appropriate Monocrome/Grayscale color in the output image.

CachePages​

Gets or sets the value of CachePages property.

public bool CachePages { get; set; }
Public Property CachePages As Boolean

Property Value​

Boolean

Licensing Info​

This property is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

Remarks​

A true value will keep the PDF pages open until Dispose method is called. A false value will close the pages immediately after rasterization.

Pages​

Gets the PdfRasterizerPageList containing the pages to rasterize.

public PdfRasterizerPageList Pages { get; }
Public Property Pages As PdfRasterizerPageList

Property Value​

PdfRasterizerPageList

Licensing Info​

This property is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

Methods​

AddLicense(String)​

Adds a license key.

public static bool AddLicense(string licenseKey)
Shared Function AddLicense(licenseKey As String) As Boolean

Parameters​

The license key to add.

Returns​

A boolean value indicating if the license is valid.

Licensing Info​

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

Remarks​

This method accepts a license key, not a serial number.

Append(InputPdf)​

Append the entire PDF document to the list of pages to rasterize.

public void Append(InputPdf inputPdf)
Sub Append(inputPdf As InputPdf)

Parameters​

Represents an input PDF to rasterize.

Licensing Info​

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

Append(InputPdf, Int32, Int32)​

Append the entire pages of the pdf document to the PdfRasterizerPageList.

public void Append(InputPdf inputPdf, int startPageNumber, int pageCount)
Sub Append(inputPdf As InputPdf, startPageNumber As Integer, pageCount As Integer)

Parameters​

Represents an input PDF to rasterize.

Starting page number of the PDF to rasterize.

Total page count of the PDF to rasterize.

Licensing Info​

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

Append(String)​

Append the entire PDF document to the list of pages to rasterize.

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

Parameters​

Physical file path of the PDF to rasterize.

Licensing Info​

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

Append(String, Int32, Int32)​

Append the entire PDF document to the list of pages to rasterize.

public void Append(string filePath, int startPageNumber, int pageCount)
Sub Append(filePath As String, startPageNumber As Integer, pageCount As Integer)

Parameters​

Physical file path of the Pdf

Starting page number of the PDF to rasterize.

Total page count of the PDF to rasterize.

Licensing Info​

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

Dispose()​

Releases all resources that are used by the current instance of the class.

public void Dispose()
Sub Dispose()

Licensing Info​

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

Draw(ImageFormat, ImageSize)​

Rasterizes all pages in the page list to an array of byte arrays containing the image data.

public Byte[][] Draw(ImageFormat imageFormat, ImageSize imageSize)
Function Draw(imageFormat As ImageFormat, imageSize As ImageSize) As Byte[][]

Parameters​

Represents the image format to use.

Represents image size to use.

Returns​

Returns the array of byte arrays containing the image data.

Licensing Info​

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

Draw(String, ImageFormat, ImageSize)​

Rasterizes all pages in the page list to an image and stores the image to the given filename.

public void Draw(string fileName, ImageFormat imageFormat, ImageSize imageSize)
Sub Draw(fileName As String, imageFormat As ImageFormat, imageSize As ImageSize)

Parameters​

Physical file path of the image.

Represents the image format to use.

Represents image size to use.

Licensing Info​

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

DrawToMultiPageTiff(Stream, TiffImageFormat, ImageSize)​

Rasterizes all pages in the page list to a multi-page TIFF image and writes it to the given stream.

public void DrawToMultiPageTiff(Stream stream, TiffImageFormat tiffImageFormat, ImageSize imageSize)
Sub DrawToMultiPageTiff(stream As Stream, tiffImageFormat As TiffImageFormat, imageSize As ImageSize)

Parameters​

The Stream to which image will be written.

Represents the TIFF image format to use.

Represents image size to use.

Licensing Info​

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

DrawToMultiPageTiff(String, TiffImageFormat, ImageSize)​

Rasterizes all pages in the page list to a multi-page TIFF image and stores it to the given filename.

public void DrawToMultiPageTiff(string fileName, TiffImageFormat tiffImageFormat, ImageSize imageSize)
Sub DrawToMultiPageTiff(fileName As String, tiffImageFormat As TiffImageFormat, imageSize As ImageSize)

Parameters​

Physical filepath of the image.

Represents the TIFF image format to use.

Represents image size to use.

Licensing Info​

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

DrawToMultiPageTiff(TiffImageFormat, ImageSize)​

Rasterizes all pages in the page list to a multi-page TIFF image and stores it to the given filename.

public Byte[] DrawToMultiPageTiff(TiffImageFormat tiffImageFormat, ImageSize imageSize)
Function DrawToMultiPageTiff(tiffImageFormat As TiffImageFormat, imageSize As ImageSize) As Byte()

Parameters​

Represents the TIFF image format to use.

Represents image size to use.

Returns​

Licensing Info​

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

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.

Licensing Info​

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

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 .

Licensing Info​

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

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.

Licensing Info​

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

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 .

Licensing Info​

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

Events​

RasterizerProgress​

Represents a progress event to inform about the number of pages rasterized.

public event ProgressChangedEventHandler PdfRasterizer.RasterizerProgress;
Public Event PdfRasterizer.RasterizerProgress As ProgressChangedEventHandler

Event Handler​

ProgressChangedEventHandler

Licensing Info​

This event is a DynamicPDF Rasterizer feature. One of the following is required for non-evaluation usage:

Examples​

This example demonstrates how to rasterize a PDF document.

Imports System
Imports ceTe.DynamicPDF.Rasterizer

Module MyModule

Sub Main()

' Create a PdfRasterizer object.
Dim rasterizer As PdfRasterizer = New PdfRasterizer("InputPdfFile.pdf") AddHandler rasterizer.RasterizerProgress, AddressOf RasterizerProgressing

' Save the image.
rasterizer.DrawToMultiPageTiff("Output.tif", TiffImageFormat.TiffWithLzw, ImageSize.Dpi72)

End Sub
Private Sub RasterizerProgressing(sender As Object, e As RasterizerProgressChangedEventArgs)
Console.WriteLine(e.PagesCompleted) Console.WriteLine("pages have been rasterized")
End Sub

End Module
using System;
using ceTe.DynamicPDF.Rasterizer;

class MyClass
{
static void Main(string[] args)
{
// Create a PdfRasterizer object.
PdfRasterizer rasterizer = new PdfRasterizer("InputPdfFile.pdf");
rasterizer.RasterizerProgress += new ProgressChangedEventHandler(RasterizerProgressing);

// Save the image.
rasterizer.DrawToMultiPageTiff("Output.tif", TiffImageFormat.TiffWithLzw, ImageSize.Dpi72);
}
static void RasterizerProgressing(object sender, RasterizerProgressChangedEventArgs e){ Console.WriteLine(e.PagesCompleted + " pages have been rasterized");}
}

See Also​

ceTe.DynamicPDF.Rasterizer