ByteScout PDF SDK - C# - Convert HTML to PDF - ByteScout

ByteScout PDF SDK – C# – Convert HTML to PDF

  • Home
  • /
  • Articles
  • /
  • ByteScout PDF SDK – C# – Convert HTML to PDF

How to convert HTML to PDF in C# with ByteScout PDF SDK

How to convert HTML to PDF in C#

This sample source code below will demonstrate you how to convert HTML to PDF in C#. ByteScout PDF SDK is the pdf library that can create, update and modify PDF files. Supports text with fonts and style selections, layers, form fields, drawing lines and objects, automatic tables, images. Can be used to create and fill pdf forms. It can be used to convert HTML to PDF using C#.

The SDK samples like this one below explain how to quickly make your application do convert HTML to PDF in C# with the help of ByteScout PDF SDK. Just copy and paste the code into your C# application’s code and follow the instruction. Further enhancement of the code will make it more vigorous.

Trial version of ByteScout PDF SDK can be downloaded for free from our website. It also includes source code samples for C# and other programming languages.

Try ByteScout PDF SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

Program.cs
      
using System; using System.Diagnostics; using System.Drawing.Printing; using Bytescout.PDF.Converters; namespace ConvertHtmlToPdf { class Program { [STAThread] 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("http://google.com", "result.pdf"); } // Open result document in default associated application (for demo purpose) ProcessStartInfo processStartInfo = new ProcessStartInfo("result.pdf"); processStartInfo.UseShellExecute = true; Process.Start(processStartInfo); } } }

Try ByteScout PDF SDK today:  60 Day Free Trial (on-premise) or  Web API (on-demand version)

VIDEO

ON-PREMISE VERSION INFORMATION

Get 60 Day Free Trial or Visit ByteScout PDF SDK Home Page

Explore ByteScout PDF SDK Documentation

Get ByteScout PDF SDK Free Training

WEB API

Get Your Free API Key

Explore Web API Documentation

Tutorials:

prev
next