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 using Blink

Platform: ASP.NET MVC |
Control: PDF |
Published Date: February 27, 2019 |
Last Revised Date: April 29, 2020

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

Due to the GDI limitations and restriction of the Azure App service environment, the Blink rendering engine does not support conversion in the Azure app service (Azure websites) and Azure function. Azure app service environment does not have elevated permissions and enough rights to launch the browser for converting HTML to PDF. But, you can convert HTML to PDF using the Blink rendering in Azure cloud service environment that has the elevated permissions and enough rights.

Also, you can overcome this limitation in Azure app service using the Linux docker container. Blink rendering engine supports conversion in the Linux docker container, and it can be deployed as Azure website using the Azure container instance. Please refer to the following KB link for more information,


Refer to the following steps to convert a HTML to PDF in Azure cloud service:

  1. Create a Web Role (WCF service) for the conversion part and host it as an Azure cloud service.
  2. Then, the Web Role (Azure cloud service) can be added as a service reference in your main application.

The following steps are used to create a Web Role for conversion:

  1. Open visual studio and create a new cloud service project. Create Azure Cloud service
  2. Create an Azure cloud service for the conversion (In this article, WCF service has been used). Select WCF service Role
  3. Install the Syncfusion.HtmlToPdfConverter.Blink.AspNet.Mvc5 NuGet package as reference to your WCF service application from NuGet.org. Install required Nuget Packages
  4. Copy the BlinkBinaries folder from the installed HtmltoPdfConverter package and paste it in the folder that contains the WCFServiceWebRole1.csproj file. Refer to the following link for pre-requisites of Blink rendering engine. 

UG: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#prerequisites BlinkBinaries loaction

Paste BlinkBinaries to this location

  1. Include the HTML to PDF conversion part in the service.

5.1)   Include BlinkBinaries folder to the project. Include BlinkBinaries in project

5.2)   Then, set Copy to output directory to copy if newer to all the BlinkBinaries (All files including inner folders and files). Copy the output directory

5.3)   Include new OperationContract in IService1 interface.

MemoryStream ConvertHtmlToPdf(string url);

Convert HTML to PDF

5.4)    Include the following namespaces and code snippet in Service1.svc for converting HTML to PDF in Azure,  refer to the following link for more information.

UG: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#url-to-pdf


using Syncfusion.HtmlConverter;
using Syncfusion.Pdf;
using System.IO;
using System.Web.Hosting;


public MemoryStream ConvertHtmlToPdf(string url)
//Initialize HTML to PDF converter with Blink rendering engine 
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.Blink);
BlinkConverterSettings blinkConverterSettings = new BlinkConverterSettings();
//Set the BlinkBinaries folder path 
blinkConverterSettings.BlinkPath = Path.Combine(HostingEnvironment.ApplicationPhysicalPath, "BlinkBinaries");
//Assign Blink converter settings to HTML converter 
htmlConverter.ConverterSettings = blinkConverterSettings;
//Convert URL to PDF 
PdfDocument document = htmlConverter.Convert(url);
MemoryStream stream = new MemoryStream();
//Save and close the PDF document  
stream.Position = 0;
return stream;
  1. Run the service in local machine and test the conversion using simple console sample in local machine.
  2. After successful conversion, deploy the service to Azure cloud service and refer the service to the main project.

    The Newtonsoft.Json package version is not 6.0.8, then include the following assembly binding redirection in the web.config file.


    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="" newVersion="" />


Refer to the following steps to publish the service to Azure could service:

  1. Right-click the service and select Publish. Publish the project
  2. Sign in and select a subscription. Microsoft Azure Account sign in
  3. Provide the Azure publish settings based on the requirement and click Publish. Provide azure settings and publish it.

Publish summary

  1. After publishing the application successfully, you can refer the service from the published URL and convert the HTML to PDF using the published service URL. Published url details

Refer to the following steps for converting HTML to PDF using the above web role service.

  1. Create a new console project. Create new console application
  2. Add a service reference with the published Azure cloud service in this project. Add service reference
  3. Invoke the ConvertHtmlToPdf method from the service. Refer to the following code snippet.
    //Initializing Basic HTTP Binding
    BasicHttpBinding binding = new BasicHttpBinding(BasicHttpSecurityMode.TransportCredentialOnly);
    binding.MaxReceivedMessageSize = int.MaxValue;
    binding.MaxBufferPoolSize = 26843545600;
    binding.MaxBufferSize = int.MaxValue;
    binding.SendTimeout = TimeSpan.MaxValue;
    binding.ReceiveTimeout = TimeSpan.MaxValue;
    binding.OpenTimeout = TimeSpan.MaxValue;
    binding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Windows;
    EndpointAddress remoteAddress = new EndpointAddress("http://azureblinktest.cloudapp.net/Service1.svc");
    //Initializing Service 
    Service1Client client = new Service1Client(binding, remoteAddress);
    //Conversion goes here 
    MemoryStream ms = client.ConvertHtmlToPdf("https://www.google.com/") as MemoryStream;
    //Saving the Output PDF document
    using (FileStream file = new FileStream("Sample.pdf", FileMode.Create, System.IO.FileAccess.Write))
          byte[] bytes = new byte[ms.Length];
          ms.Read(bytes, 0, (int)ms.Length);
          file.Write(bytes, 0, bytes.Length);


  1. By converting HTML to PDF, you will get the PDF document as follows. Output PDF document

The samples of WCF service and console sample are attached in this article for your reference. Find the samples from the following zip files.

WCF service: AzureCloudServiceBlink.zip.

Console sample: BlinkAzureSample.zip.

Refer here to convert HTML to PDF in Azure using WebKit rendering engine.

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
Jordan Capa
Apr 23, 2019

thank you for the information and clear instructions! Try ZetPDF.com of you're looking for a faster pdf sdk. I used it before and it will help you a lot in PDF related informations.


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