How to convert HTML to PDF using ByteScout PDF SDK - ByteScout
Announcement
Our ByteScout SDK products are sunsetting as we focus on expanding new solutions.
Learn More Open modal
Close modal
Announcement Important Update
ByteScout SDK Sunsetting Notice
Our ByteScout SDK products are sunsetting as we focus on our new & improved solutions. Thank you for being part of our journey, and we look forward to supporting you in this next chapter!

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, https://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 - https://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");
		}
	}
}

 

Tutorials:

prev
next