We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to convert HTML to PDF in Azure website

Platform: ASP.NET MVC |
Control: PDF

The Syncfusion HTML to PDF converter for .NET is used to convert webpages, SVG, MHTML, and HTML to PDF. Using this library, you can convert HTML to PDF in Azure website using C# and VB.NET.

Steps to convert HTML to PDF in Azure website programmatically:

  1. Open Visual Studio and create ASP.NET MVC project. Create a ASP.NET Web application project
  2. Install the Syncfusion.HtmlToPdfConverter.QtWebkit.AspNet.Mvc5 NuGet package as a reference to your .NET Framework application from the NuGet.org. Install required Nuget packages
  3. Copy the QtBinaries folder from the installed HtmltoPdfConverter package and paste it in the folder that contains the HTMLtoPDF_Azure.csproj file. Location of QtBinaries folder Paste location of QtBinaries


  1. After installing the package, include the QtBinaries folder to the project. Screenshot for include QtBinaries in project
  2. Then, set Copy to output directory to copy always to all the QtBinaries (All files including inner folders and files). Screenshot for set copy to output directory to copy always
  3. Add an Export To PDF button in index.cshtml. Add code snippet for Export to PDF button
  4. Include the following namespaces and code snippet in controller for converting HTML to PDF in Azure website. Refer to the following link for more information.

UG: https://help.syncfusion.com/file-formats/pdf/converting-html-to-pdf

// [C# Code]
using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
using System.IO;


public ActionResult ExportToPDF()
//Initialize HTML to PDF converter 
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = Server.MapPath("~/QtBinaries/");
//Assign WebKit settings to HTML converter
htmlConverter.ConverterSettings = settings;
//Convert URL to PDF
PdfDocument document = htmlConverter.Convert("http://www.google.com");
MemoryStream stream = new MemoryStream();
//Save and close the PDF document 
return File(stream.ToArray(), System.Net.Mime.MediaTypeNames.Application.Pdf, "Sample.pdf");

Screen shot for added code snippet

  1. Now, check the conversion in local machine.

Refer to the following steps to publish as Azure web application:

  1. Right-click the project and select Publish. Publish


  1. Create a new profile in publish window. Create new profile in publish window


  1. Create App service using Azure subscription and select a hosting plan. Create App Service
  2. HTML to PDF conversion works from basic hosting plan (B1). So, select the hosting plan as required. HTML to PDF conversion will not work if the hosting plan is Free/Shared. Configure hosting plan
  3. After creating a profile, click the publish button. Publish Publish status


  1. Now, the published website will open in the browser, then you can export the webpage to PDF. Published website
  2. By converting HTML to PDF, you will get the PDF document as follows. HTML to PDF output document

A complete working sample can be downloaded from HTMLToPDF_Azure.zip.

Refer here to include the OPENSSL assemblies in Azure website.

Take a moment to peruse the documentation for Converting HTML to PDF, where you will find various options for URL to PDF, HTML string to PDF, and Hyperlinks.

Refer here to explore the rich set of Syncfusion Essential PDF features.

2X faster development

The ultimate ASP.NET MVC UI toolkit to boost your development speed.
You must log in to leave a comment

Please sign in to access our KB

This page will automatically be redirected to the sign-in page in 10 seconds.

Up arrow icon

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile