Skip to main content

AsyncConverter [Obsolete]

Version: 3.0

cete.dynamicpdf.conversion.asyncconverter

AsyncConverter [Obsolete]​

Obsolete. Represents a asynchronised conversion.

public class AsyncConverter : Converter
Public Class AsyncConverter
Inherits Converter

Inheritance: Object → Converter → AsyncConverter

Licensing Info​

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

Examples​

This example shows how to convert files to PDF asynchronously.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf")
While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Exit While
End If
End While
End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine(e.SourceFilePath + " was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

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

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf");
while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Remarks​

NOTE: This Class is obsolete. Use ConvertAsync(System.String) property instead.

Constructors​

AsyncConverter()​

Initializes a new instance of AsyncConverter class.

public AsyncConverter()
Public Sub New ()

Licensing Info​

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

Methods​

Convert(Byte[], String)​

Converts the source byte array to a PDF and get the output PDF as byte array.

public AsyncConversion Convert(Byte[] inputData, string inputFileName)
Function Convert(inputData As Byte(), inputFileName As String) As AsyncConversion

Parameters​

Byte array of the source file that need to be converted.

File name or extension of the source file.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert byte array of source file to PDF and returns the converted PDF in byte array asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim inputData() As Byte = File.ReadAllBytes("C:\MyDocument.xls")

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert(inputData, ".xls")

While (True)
If (asyncConversion.Completed) Then
Dim MyData() As Byte = asyncConversion.GetOutputData()
Exit While
End If
End While

End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine("Source file in byte array was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine("Conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

byte[] inputData = File.ReadAllBytes(@"C:\MyDocument.xls");

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(inputData, @".xls");

while(true)
{
if (asyncConversion.Completed)
{
byte[] pdfData = asyncConversion.GetOutputData();
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Remarks​

Use GetOutputData method of AsyncConversion class to get the output in byte array.

Convert(Byte[], String, ConversionOptions, Byte[])​

Converts the source byte array to a PDF and get the output PDF as byte array.

public AsyncConversion Convert(Byte[] inputData, string inputFileName, ConversionOptions options, Byte[] appendToPdf)
Function Convert(inputData As Byte(), inputFileName As String, options As ConversionOptions, appendToPdf As Byte()) As AsyncConversion

Parameters​

Byte array of the source file that need to be converted.

File name or extension of the source file.

Instance of a specific conversion options class as per the input file type ExcelConversionOptions WordConversionOptions etc or Instance of ConversionOptions class that represents the conversion options.

Byte array for which output to be appended.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert byte array of source file to PDF and returns the converted PDF in byte array asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim inputData() As Byte = File.ReadAllBytes("C:\MyDocument.rtf")
Dim toAppend() As Byte = File.ReadAllBytes("C:\MyDocument.pdf")
Dim conversionOptions As ConversionOptions = New ConversionOptions(PageSize.A4, PageOrientation.Landscape, 75, 75, True)

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert(inputData, ".rtf", conversionOptions, toAppend)

While (True)
If (asyncConversion.Completed) Then
Dim MyData() As Byte = asyncConversion.GetOutputData()
Exit While
End If
End While

End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine("Source file in byte array was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine("Conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using Syste.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

byte[] inputData = File.ReadAllBytes(@"C:\MyDocument.rtf");
byte[] toAppend = File.ReadAllBytes(@"C:\MyDocument.pdf");
ConversionOptions conversionOptions = new ConversionOptions(PageSize.A4,PageOrientation.Landscape,75,75,true);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(inputData, @".rtf",conversionOptions,toAppend);

while(true)
{
if (asyncConversion.Completed)
{
byte[] pdfData = asyncConversion.GetOutputData();
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Remarks​

Use GetOutputData method of AsyncConversion class to get the output in byte array.

Convert(Byte[], String, String)​

Converts the source byte array to a PDF of the given name.

public AsyncConversion Convert(Byte[] inputData, string inputFileName, string outputFilePath)
Function Convert(inputData As Byte(), inputFileName As String, outputFilePath As String) As AsyncConversion

Parameters​

Byte array of the source file that need to be converted.

File name or extension of the source file.

File path to store the converted pdf.

Returns​

Returns an instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert byte array of source files to PDF asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim inputData() As Byte =File.ReadAllBytes("C:\MyDocument.rtf")

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert(inputData, ".rtf", "C:\MyOutput.pdf")
While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Exit While
End If
End While
End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine(e.SourceFilePath + " was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

byte[] inputData = File.ReadAllBytes(@"C:\MyDocument.rtf");

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(inputData,".rtf", @"C:\MyOutput.pdf");
while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Convert(Byte[], String, String, ConversionOptions)​

Converts the source byte array to a PDF of the given name.

public AsyncConversion Convert(Byte[] inputData, string inputFileName, string outputFilePath, ConversionOptions options)
Function Convert(inputData As Byte(), inputFileName As String, outputFilePath As String, options As ConversionOptions) As AsyncConversion

Parameters​

Byte array of the source file that need to be converted.

File name or extension of the source file.

File path to store the converted pdf.

Instance of a specific conversion options class as per the input file type ExcelConversionOptions WordConversionOptions etc or Instance of ConversionOptions class that represents the conversion options.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert byte array of source files to PDF asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim conversionOptions As ConversionOptions = New ConversionOptions(PageSize.A4, PageOrientation.Landscape, 75, 75, True)

Dim inputData() As Byte = File.ReadAllBytes("C:\MyDocument.rtf")

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert(inputData, ".rtf", "C:\MyOutput.pdf", conversionOptions)
While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Exit While
End If
End While
End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine(e.SourceFilePath + " was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

byte[] inputData = File.ReadAllBytes(@"C:\MyDocument.rtf");

// create an instance of ConversionOptions class.
ConversionOptions conversionOptions = new ConversionOptions(PageSize.A4,PageOrientation.Landscape,75,75,true);

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(inputData,".rtf", @"C:\MyOutput.pdf",conversionOptions);
while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Convert(String)​

Converts the source file to a PDF and get the output as byte array.

public AsyncConversion Convert(string inputFilePath)
Function Convert(inputFilePath As String) As AsyncConversion

Parameters​

Source file path for conversion.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert source file to PDF and returns the converted PDF in byte array asynchronously.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.rtf")

While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Dim output=asyncConversion.GetOutputData
Exit While
End If
End While

End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine(e.SourceFilePath + " was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

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

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.rtf");

while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Remarks​

Use GetOutputData method of AsyncConversion class to get the output in byte array.

Convert(String, ConversionOptions, Byte[])​

Converts the source file to a PDF and get the output PDF in byte array.

public AsyncConversion Convert(string inputFilePath, ConversionOptions options, Byte[] appendToPdf)
Function Convert(inputFilePath As String, options As ConversionOptions, appendToPdf As Byte()) As AsyncConversion

Parameters​

Source file path for conversion.

Instance of a specific conversion options class as per the input file type ExcelConversionOptions WordConversionOptions etc or Instance of ConversionOptions class that represents the conversion options.

Byte array of existing PDF to which output to be appended.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert source file to a PDF in byte array and append to the existing PDF in byte array asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' create an instance of ConversionOptions class
Dim conversionOptions As ConversionOptions = New ConversionOptions(PageSize.A4, PageOrientation.Landscape, 75, 75, True)

Dim appendToPdf() As Byte = File.ReadAllBytes("C:\MyDocument.pdf")

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.rtf", conversionOptions, appendToPdf)

While (True)
If (asyncConversion.Completed) Then
Dim MyData() As Byte = asyncConversion.GetOutputData()
Exit While
End If
End While

End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine(e.SourceFilePath + " was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

byte[] appendToPdf = File.ReadAllBytes(@"C:\MyDocument.pdf");

// create an instance of ConversionOptions class.
ConversionOptions conversionOptions = new ConversionOptions(PageSize.A4,PageOrientation.Landscape,75,75,true);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.rtf", conversionOptions, appendToPdf);

while(true)
{
if (asyncConversion.Completed)
{
byte[] pdfData = asyncConversion.GetOutputData();
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Remarks​

Use GetOutputData method of AsyncConversion class to get the output in byte array.

Convert(String, String)​

Converts the source file to a PDF of the given name.

public AsyncConversion Convert(string sourceFilePath, string outputFilePath)
Function Convert(sourceFilePath As String, outputFilePath As String) As AsyncConversion

Parameters​

Source file path for conversion.

File path to store the converted pdf.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert files to PDF asynchronously.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf")
While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Exit While
End If
End While
End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine(e.SourceFilePath + " was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

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

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf");
while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

Convert(String, String, ConversionOptions)​

Converts the source file to a PDF of the given name.

public AsyncConversion Convert(string sourceFilePath, string outputFilePath, ConversionOptions conversionOptions)
Function Convert(sourceFilePath As String, outputFilePath As String, conversionOptions As ConversionOptions) As AsyncConversion

Parameters​

Source file path for conversion.

File path to store the converted pdf.

Instance of a specific conversion options class as per the input file type ExcelConversionOptions WordConversionOptions etc or Instance of ConversionOptions class that represents the conversion options.

Returns​

Returns an instance of AsyncConversion class represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert files to PDF asynchronously by providing Width,height and margin as parameters.

Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

' create an instance of ConversionOptions class.
Dim conversionOptions As ConversionOptions = New ConversionOptions(550, 650, 75)

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call Convert method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.Convert("C:\MyDocument.doc", "C:\MyOutput.pdf", conversionOptions)
While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Exit While
End If
End While
End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine(e.SourceFilePath + " was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

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

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

// create an instance of ConversionOptions class.
ConversionOptions conversionOptions = new ConversionOptions(550, 650, 75);

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call Convert method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.Convert(@"C:\MyDocument.doc", @"C:\MyOutput.pdf", conversionOptions);
while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(e.SourceFilePath + " conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

ConvertHtmlString(String)​

Converts the HTML string to a PDF and get the output PDF as byte array.

public AsyncConversion ConvertHtmlString(string htmlString)
Function ConvertHtmlString(htmlString As String) As AsyncConversion

Parameters​

HTML string for conversion.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert HTML string to PDF and get the output as byte array asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim htmlString As String = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>"

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.ConvertHtmlString(htmlString)

While (True)
If (asyncConversion.Completed) Then
Dim MyData() As Byte =asyncConversion.GetOutputData()
Exit While
End If
End While

End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine("HTML string was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine("Conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.ConvertHtmlString(htmlString);

while(true)
{
if (asyncConversion.Completed)
{
byte[] MyData = asyncConversion.GetOutputData();
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine("HTML string was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine("HTML string conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

ConvertHtmlString(String, HtmlConversionOptions)​

Converts the HTML string to a PDF and get the output PDF as byte array.

public AsyncConversion ConvertHtmlString(string htmlString, HtmlConversionOptions options)
Function ConvertHtmlString(htmlString As String, options As HtmlConversionOptions) As AsyncConversion

Parameters​

HTML string for conversion.

Instance of HtmlConversionOptions class that represents the HTML string conversion options.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert HTML string to PDF and get the output as byte array asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim htmlString As String = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>"

' create an instance of HtmlConversionOptions class.
Dim htmlConversionOptions As HtmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50)

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.ConvertHtmlString(htmlString,htmlConversionOptions)

While (True)
If (asyncConversion.Completed) Then
Dim MyData() As Byte =asyncConversion.GetOutputData()
Exit While
End If
End While

End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine("HTML string was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine("Conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

// create an instance of HtmlConversionOptions class.
HtmlConversionOptions htmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50);

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.ConvertHtmlString(htmlString,htmlConversionOptions);

while(true)
{
if (asyncConversion.Completed)
{
byte[] MyData = asyncConversion.GetOutputData();
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine("HTML string was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine("HTML string conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

ConvertHtmlString(String, HtmlConversionOptions, Byte[])​

Converts the HTML string to a PDF and get the output PDF as byte array.

public AsyncConversion ConvertHtmlString(string htmlString, HtmlConversionOptions options, Byte[] appendToPdf)
Function ConvertHtmlString(htmlString As String, options As HtmlConversionOptions, appendToPdf As Byte()) As AsyncConversion

Parameters​

HTML string for conversion.

Instance of HtmlConversionOptions class that represents the HTML string conversion options.

Byte array of existing PDF to which output to be appended.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert HTML string to PDF and get the output as byte array asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim htmlString As String = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>"

' create an instance of HtmlConversionOptions class.
Dim htmlConversionOptions As HtmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait,50, 50,True)

Dim appendToPdf() As Byte = File.ReadAllBytes("C:\MyDocument.pdf")

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.ConvertHtmlString(htmlString, htmlConversionOptions, appendToPdf)

While (True)
If (asyncConversion.Completed) Then
Dim MyData() As Byte =asyncConversion.GetOutputData()
Exit While
End If
End While

End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine("HTML string was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine("HTML string Conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

// create an instance of HtmlConversionOptions class.
HtmlConversionOptions htmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50,50,true);

byte[] appendToPdf = File.ReadAllBytes(@"C:\MyDocument.pdf");

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.ConvertHtmlString(htmlString, htmlConversionOptions,appendToPdf);

while(true)
{
if (asyncConversion.Completed)
{
byte[] MyData = asyncConversion.GetOutputData();
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine(" HTML string was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine(" HTML string conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

ConvertHtmlString(String, String)​

Converts the HTML string to a PDF of the given name.

public AsyncConversion ConvertHtmlString(string htmlString, string outputFilePath)
Function ConvertHtmlString(htmlString As String, outputFilePath As String) As AsyncConversion

Parameters​

HTML string for conversion.

File path to store the converted pdf.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert HTML string to PDF asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim htmlString As String = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>"

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.ConvertHtmlString(htmlString,"C:\MyDocument.pdf")
While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Exit While
End If
End While
End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine("HTML string was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine("Conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.ConvertHtmlString(htmlString, "C:\MyDocument.Pdf");
while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine("HTML string was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine("conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

ConvertHtmlString(String, String, HtmlConversionOptions)​

Converts the HTML string to a PDF of the given name.

public AsyncConversion ConvertHtmlString(string htmlString, string outputFilePath, HtmlConversionOptions options)
Function ConvertHtmlString(htmlString As String, outputFilePath As String, options As HtmlConversionOptions) As AsyncConversion

Parameters​

HTML string for conversion.

File path to store the converted pdf.

Instance of HtmlConversionOptions class that represents the HTML string conversion options.

Returns​

Returns a instance of AsyncConversion class that represents the status of conversion.

Licensing Info​

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

Examples​

This example shows how to convert HTML string to PDF asynchronously.

Imports System.IO
Imports ceTe.DynamicPDF.Conversion

Module Module1

Sub Main()

' create an instance of AsyncConverter
Dim converter As AsyncConverter = New AsyncConverter

Dim htmlString As String = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>"

' create an instance of HtmlConversionOptions class.
Dim htmlConversionOptions As HtmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50)

' Events to know if conversion completed successfully or not
AddHandler converter.Converted, AddressOf converter_Converted
AddHandler converter.ConversionError, AddressOf converter_ConversionError

' Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
Dim asyncConversion As AsyncConversion = converter.ConvertHtmlString(htmlString,"C:\MyDocument.pdf", htmlConversionOptions)
While (True)
If(asyncConversion.Aborted Or asyncConversion.Exception IsNot Nothing) Then
Exit While
ElseIf(asyncConversion.Completed) Then
Exit While
End If
End While
End Sub

Sub converter_Converted(ByVal sender As Object, ByVal e As ConvertedEventArgs)

Console.WriteLine("HTML string was converted successfully.")

End Sub

Sub converter_ConversionError(ByVal sender As Object, ByVal e As ConversionErrorEventArgs)

Console.WriteLine("Conversion failed for the following reason:")
Console.WriteLine("\"" + e.Exception.Message + " \ "")

End Sub
End Module
using System;
using System.IO;
using ceTe.DynamicPDF.Conversion;

class MyClass
{
static void Main()
{
// create an instance of AsyncConverter
AsyncConverter converter = new AsyncConverter();

string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

// create an instance of HtmlConversionOptions class.
HtmlConversionOptions htmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50);

// Events to know if conversion completed successfully or not
converter.Converted += new ConvertedEventHandler(converter_Converted);
converter.ConversionError += new ConversionErrorEventHandler(converter_ConversionError);

// Call ConvertHtmlString method to start conversion asynchronously and Get the status of conversion
AsyncConversion asyncConversion = converter.ConvertHtmlString(htmlString, "C:\MyDocument.Pdf", htmlConversionOptions);
while(true)
{
if(asyncConversion.Aborted ||asyncConversion.Exception== null)
{
break;
}
else if (asyncConversion.Completed)
{
break;
}
}
}

private static void converter_Converted(object sender, ConvertedEventArgs e)
{
Console.WriteLine("HTML string was converted successfully.");
}

private static void converter_ConversionError(object sender, ConversionErrorEventArgs e)
{
Console.WriteLine("HTML string conversion failed for the following reason:");
Console.WriteLine("\"" + e.Exception.Message + "\"");
}
}

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 Converter 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 Converter 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 Converter 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 Converter feature. One of the following is required for non-evaluation usage:

Events​

ConversionError​

Occurs when a conversion error occurs. (Inherited from Converter)

public event ConversionErrorEventHandler AsyncConverter.ConversionError;
Public Event AsyncConverter.ConversionError As ConversionErrorEventHandler

Event Handler​

ConversionErrorEventHandler

Licensing Info​

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

Remarks​

Used when the conversion is of type Async.

Converted​

Occurs when a document is successfully converted. (Inherited from Converter)

public event ConvertedEventHandler AsyncConverter.Converted;
Public Event AsyncConverter.Converted As ConvertedEventHandler

Event Handler​

ConvertedEventHandler

Licensing Info​

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

Remarks​

Used when the conversion is of type Async.

ProgressChanged​

Occurs when the status of a document conversion changes. (Inherited from Converter)

public event ProgressChanged AsyncConverter.ProgressChanged;
Public Event AsyncConverter.ProgressChanged As ProgressChanged

Event Handler​

ProgressChanged

Licensing Info​

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

See Also​

ceTe.DynamicPDF.Conversion