Converter.ConvertHtmlStringAsync

Overloads

ConvertHtmlStringAsync(String)Converts the HTML string to PDF of the given name.
ConvertHtmlStringAsync(String, HtmlConversionOptions)Converts the HTML string to PDF of the given name.
ConvertHtmlStringAsync(String, HtmlConversionOptions, Byte[])Converts the HTML string to PDF of the given name.
ConvertHtmlStringAsync(String, String)Converts the HTML string to PDF of the given name.
ConvertHtmlStringAsync(String, String, HtmlConversionOptions)Converts the HTML string to PDF of the given name.

ConvertHtmlStringAsync(String)

Converts the HTML string to PDF of the given name.

public static Task<Byte[]> ConvertHtmlStringAsync(string htmlString)
Shared Function ConvertHtmlStringAsync(htmlString As String) As Task(Of Byte())

Parameters

htmlString
String

HTML string for conversion.

Returns

Task<Byte[]>

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 file using ConvertAsync.
Imports ceTe.DynamicPDF.Conversion

Module Module1

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

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

        ' Call ConvertHtmlStringAsync method to do conversion
        Dim result() As Byte=Await Converter.ConvertHtmlStringAsync(htmlString)
        File.WriteAllBytes("C:\MyOutput.pdf",result)
        
    End Function
    
    Sub Main()      
    
        run().Wait()

    End Sub

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

class MyClass
{
    static async Task run()
    {
        
       string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

        // Call ConvertHtmlStringAsync method to do conversion
       byte[] result= await Converter.ConvertHtmlStringAsync(htmlString);   
       File.WriteAllBytes("C:\MyOutput.pdf",result);
     
    }
    static void Main()
    { 
        run().Wait();
    }   
}

Remarks

Use HtmlConverter class instead

ConvertHtmlStringAsync(String, HtmlConversionOptions)

Converts the HTML string to PDF of the given name.

public static Task<Byte[]> ConvertHtmlStringAsync(string htmlString, HtmlConversionOptions conversionOptions)
Shared Function ConvertHtmlStringAsync(htmlString As String, conversionOptions As HtmlConversionOptions) As Task(Of Byte())

Parameters

htmlString
String

HTML string for conversion.

conversionOptions
HtmlConversionOptions

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

Returns

Task<Byte[]>

Converted PDF stored in byte array.

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 file using ConvertAsync.
Imports ceTe.DynamicPDF.Conversion

Module Module1

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

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

        ' Call ConvertHtmlStringAsync method to do conversion
        Dim result() As Byte= Await Converter.ConvertHtmlStringAsync(htmlString, htmlConversionOptions)
        File.WriteAllBytes("C:\MyOutput.pdf",result)
        
    End Function
    
    Sub Main()      
    
        run().Wait()

    End Sub

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

class MyClass
{
    static async Task run()
    {
     // create an instance of HtmlConversionOptions class.
        HtmlConversionOptions htmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50);
        
       string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

        // Call ConvertHtmlStringAsync method to do conversion
       byte[] result=await Converter.ConvertHtmlStringAsync(htmlString,htmlConversionOptions);   
       File.WriteAllBytes("C:\MyOutput.pdf",result);
     
    }
    static void Main()
    { 
        run().Wait();
    }   
}

Remarks

Use HtmlConverter class instead

ConvertHtmlStringAsync(String, HtmlConversionOptions, Byte[])

Converts the HTML string to PDF of the given name.

public static Task<Byte[]> ConvertHtmlStringAsync(string htmlString, HtmlConversionOptions conversionOptions, Byte[] appendToPdf)
Shared Function ConvertHtmlStringAsync(htmlString As String, conversionOptions As HtmlConversionOptions, appendToPdf As Byte()) As Task(Of Byte())

Parameters

htmlString
String

HTML string for conversion.

conversionOptions
HtmlConversionOptions

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

appendToPdf
Byte[]

Byte array of the PDF to precede the converted output.

Returns

Task<Byte[]>

Converted PDF stored in byte array.

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 file using ConvertAsync.
Imports ceTe.DynamicPDF.Conversion

Module Module1

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

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

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

        ' Call ConvertHtmlStringAsync method to do conversion
        Dim MyData() As Byte =Await Converter.ConvertHtmlStringAsync(htmlString, htmlConversionOptions, appendToPdf)
        
        File.WriteAllBytes("C:\MyOutput.pdf",MyData)
        
    End Function
    
    Sub Main()      
    
        run().Wait()

    End Sub

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

class MyClass
{
    static async Task run()
    {
     // create an instance of HtmlConversionOptions class.
        HtmlConversionOptions htmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50);
        
       string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

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

        // Call ConvertHtmlStringAsync method to do conversion
        byte[] MyData =await Converter.ConvertHtmlStringAsync(htmlString, htmlConversionOptions, appendToPdf); 
        
       File.WriteAllBytes("C:\MyOutput.pdf",MyData);
     
    }
    static void Main()
    { 
        run().Wait();
    }   
}

Remarks

Use HtmlConverter class instead

ConvertHtmlStringAsync(String, String)

Converts the HTML string to PDF of the given name.

public static Task<bool> ConvertHtmlStringAsync(string htmlString, string outputFilePath)
Shared Function ConvertHtmlStringAsync(htmlString As String, outputFilePath As String) As Task(Of Boolean)

Parameters

htmlString
String

HTML string for conversion.

outputFilePath
String

File path to store the converted pdf.

Returns

Task<bool>

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 file using ConvertAsync.
Imports ceTe.DynamicPDF.Conversion

Module Module1

    Async Function run() As Task
    
        Dim htmlString As String = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>"

        ' Call ConvertHtmlStringAsync method to do conversion
        Await Converter.ConvertHtmlStringAsync(htmlString, "C:\MyOutput.pdf")
        
    End Function
    
    Sub Main()      
    
        run().Wait()

    End Sub

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

class MyClass
{
    static async Task run()
    {
       string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

        // Call ConvertHtmlStringAsync method to do conversion
       await Converter.ConvertHtmlStringAsync(htmlString, @"C:\MyOutput.pdf");   
     
    }
    static void Main()
    { 
        run().Wait();
    }   
}

Remarks

Use HtmlConverter class instead

ConvertHtmlStringAsync(String, String, HtmlConversionOptions)

Converts the HTML string to PDF of the given name.

public static Task<bool> ConvertHtmlStringAsync(string htmlString, string outputFilePath, HtmlConversionOptions conversionOptions)
Shared Function ConvertHtmlStringAsync(htmlString As String, outputFilePath As String, conversionOptions As HtmlConversionOptions) As Task(Of Boolean)

Parameters

htmlString
String

HTML string for conversion.

outputFilePath
String

File path to store the converted pdf.

conversionOptions
HtmlConversionOptions

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

Returns

Task<bool>

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 file using ConvertAsync.
Imports ceTe.DynamicPDF.Conversion

Module Module1

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

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

        ' Call ConvertHtmlStringAsync method to do conversion
        Await Converter.ConvertHtmlStringAsync(htmlString, "C:\MyOutput.pdf", htmlConversionOptions)
        
    End Function
    
    Sub Main()      
    
        run().Wait()

    End Sub

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

class MyClass
{
    static async Task run()
    {
        // create an instance of HtmlConversionOptions class.
        HtmlConversionOptions htmlConversionOptions = new HtmlConversionOptions(PageSize.Letter,PageOrientation.Portrait, 50);
        
       string htmlString = "<html><head><title>ceTe software</title></head><body>DynamicPDF Converter</body></html>";

        // Call ConvertHtmlString method to do conversion
       await Converter.ConvertHtmlStringAsync(htmlString, @"C:\MyOutput.pdf", htmlConversionOptions);  
     
    }
    static void Main()
    { 
        run().Wait();
    }   
}

Remarks

Use HtmlConverter class instead

See Also

Converter
ceTe.DynamicPDF.Conversion

In this topic