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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to convert HTML to PDF in ASP.NET Core Linux

Syncfusion HTML to PDF for .NET used to convert webpages, SVG, MHTML, and HTML to PDF. Using this library, you can convert HTML to PDF in ASP.NET Core application using .Net Standard 2.0.

Minimum product version:

Minimum .NET core version: 2.0.0

For converting HTML to PDF in Linux, the following pre-requisite packages should be installed in the Linux machine. To do that, enter the following commands in the terminal:

$ sudo apt-get update

$ sudo apt-get install xvfb

$ sudo apt-get install libssl-dev

$ sudo apt-get install libx11-dev libx11-xcb-dev libxcb-icccm4-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-render-util0-dev libxcb-render0-dev libxcb-shm0-dev libxcb-util0-dev libxcb-xfixes0-dev libxcb-xkb-dev libxcb1-dev libxfixes-dev libxrandr-dev libxrender-dev

The following assemblies or NuGet package is required for converting HTML to PDF in ASP.NET Core Linux.

Assemblies required:

  • Syncfusion.Compression.Portable.dll
  • Syncfusion.Pdf.Portable.dll
  • Syncfusion.HtmlConverter.Portable.dll
  • QtBinaries

You can get all the previously mentioned assemblies, QtBinaries, and working samples by installing the HTML converter installer for Linux available in the following link.

HTML converter Linux (zip file): https://www.syncfusion.com/downloads/latest-version


Install the Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core NuGet package as reference to your .NET Core application from NuGet.org. The NuGet package contains QtBinaries for all platforms (Windows, Linux and Mac). Copy the QtBinariesLinux folder from the NuGet package installed location and paste it into your application folder to use it for conversion.

NuGet Installed location: /.nuget/packages/syncfusion.htmltopdfconverter.qtwebkit.net.core/XX.X.X.XX/lib

Steps to convert HTML to PDF in ASP.NET Core Linux programmatically:

  1. Extract the zip file (syncfusionessentialwebkit.zip) in Linux and open the QtBinaries folder in file explorer.
  2. Provide the execute permission for Syncfusion.WebKitWrapper file inside the QtBinaries folder. Refer to the following screenshot.

  1. Open the project folder (HtmlToPdf.csproj) in Linux terminal, then, enter the following commands one by one to run the sample.
  • dotnet restore
  • dotnet build
  • dotnet run
  1. Enter the localhost server path in the web browser to view the result.

Use the following code snippet to convert HTML to PDF in ASP.NET Core Linux.


A complete working sample can be downloaded from HTMLtoPDF_Linux.zip

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.

Article ID: Published Date: Last Revised Date: Platform: Control:
8481 02/23/2018 12/05/2018 ASP.NET Core PDF
Did you find this information helpful?
Add Comment
You must log in to leave a comment

Please sign in to access our KB

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

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