Convert HTML to PDF | C#ByteScout PDF SDK

Convert HTML to PDF | C#


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

namespace ConvertHtmlToPdf
    class Program
        static void Main(string[] args)
            using (HtmlToPdfConverter converter = new HtmlToPdfConverter())
                converter.PageSize = PaperKind.A4;
                converter.Orientation = PaperOrientation.Portrait;
                converter.Footer = "FOOTER TEXT"; // optional footer text

                converter.ConvertHtmlToPdf("sample.html", "result.pdf");

                // You can also pass a link instead of the input file:  
                //converter.ConvertHtmlToPdf("", "result.pdf");

            // Open result document in default associated application (for demo purpose)
            ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf");
            processStartInfo.UseShellExecute = true;