AsyncConverter.Convert

Overloads

Convert(Byte[], String)Converts the source byte array to a PDF and get the output PDF as byte array.
Convert(Byte[], String, ConversionOptions, Byte[])Converts the source byte array to a PDF and get the output PDF as byte array.
Convert(Byte[], String, String)Converts the source byte array to a PDF of the given name.
Convert(Byte[], String, String, ConversionOptions)Converts the source byte array to a PDF of the given name.
Convert(String)Converts the source file to a PDF and get the output as byte array.
Convert(String, ConversionOptions, Byte[])Converts the source file to a PDF and get the output PDF in byte array.
Convert(String, String)Converts the source file to a PDF of the given name.
Convert(String, String, ConversionOptions)Converts the source file to a PDF of the given name.

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

inputData
Byte[]

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

inputFileName
String

File name or extension of the source file.

Returns

AsyncConversion

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

inputData
Byte[]

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

inputFileName
String

File name or extension of the source file.

options
ConversionOptions

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.

appendToPdf
Byte[]

Byte array for which output to be appended.

Returns

AsyncConversion

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

inputData
Byte[]

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

inputFileName
String

File name or extension of the source file.

outputFilePath
String

File path to store the converted pdf.

Returns

AsyncConversion

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

inputData
Byte[]

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

inputFileName
String

File name or extension of the source file.

outputFilePath
String

File path to store the converted pdf.

options
ConversionOptions

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

AsyncConversion

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

inputFilePath
String

Source file path for conversion.

Returns

AsyncConversion

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

inputFilePath
String

Source file path for conversion.

options
ConversionOptions

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.

appendToPdf
Byte[]

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

Returns

AsyncConversion

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

sourceFilePath
String

Source file path for conversion.

outputFilePath
String

File path to store the converted pdf.

Returns

AsyncConversion

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

sourceFilePath
String

Source file path for conversion.

outputFilePath
String

File path to store the converted pdf.

conversionOptions
ConversionOptions

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

AsyncConversion

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 + "\"");
    }
}

See Also

AsyncConversion
AsyncConverter
ceTe.DynamicPDF.Conversion

In this topic