How to convert HTML to PDF using ByteScout PDF SDK

  • Home
  • /
  • Articles
  • /
  • How to convert HTML to PDF using ByteScout PDF SDK

The example demonstrates how to convert HTML file to PDF using ByteScout PDF SDK.

Following these developer tips will allow you to proceed with a speedy HTML file converting. For more assistance, check other tutorials about PDF generator api.

Program.vb:
VB

'*******************************************************************
'       ByteScout PDF SDK
'                                                                   
'       Copyright © 2016 Bytescout, http://www.bytescout.com        
'       ALL RIGHTS RESERVED                                         
'                                                                   
'*******************************************************************

Imports Bytescout.PDF.Converters

''' <summary>
''' This example demonstrates how to convert HTML file to PDF document.
''' </summary>
Class Program

    Shared Sub Main()

        ' Create converter instance
        Using converter As New HtmlToPdfConverter()

            ' Perform conversion
            converter.ConvertHtmlToPdf("sample.html", "result.pdf")

        End Using

        ' Open result document in default PDF viewer
        Process.Start("result.pdf")

    End Sub

End Class

Program.cs:
C#

//*******************************************************************
//       ByteScout PDF SDK		                                     
//                                                                   
//       Copyright © 2016 ByteScout - http://www.bytescout.com       
//       ALL RIGHTS RESERVED                                         
//                                                                   
//*******************************************************************

using System.Diagnostics;
using Bytescout.PDF.Converters;

namespace ConvertHtmlToPdf
{
	/// <summary>
	/// This example demonstrates how to convert HTML file to PDF document.
	/// </summary>
	class Program
	{
		static void Main()
		{
            // Create converter instance
            using (HtmlToPdfConverter converter = new HtmlToPdfConverter())
		    {
                // Perform conversion
		        converter.ConvertHtmlToPdf("sample.html", "result.pdf");
		    }

		    // Open result document in default PDF viewer
		    Process.Start("result.pdf");
		}
	}
}

 


prev
next