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 Linux docker container

Syncfusion WebKit HTML converter supports HTML to PDF conversion Linux docker container using ASP.NET Core.

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


  • Syncfusion.Compression.Portable.dll
  • Syncfusion.Pdf.Portable.dll
  • Syncfusion.HtmlConverter.Portable.dll
  • QtBinaries folder for Linux

All the above-mentioned assemblies and QtBinaries can get by downloading the WebKit HTML converter for Linux available in the below link.

WebKit HTML Converter Linux (ZIP file): https://www.syncfusion.com/downloads/latest-version


  • Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core



Note: QtBinaries folder will be available in the NuGet package installed location.

Example: C:\Users\<<username>>\.nuget\packages\syncfusion.htmltopdfconverter.qtwebkit.net.core\XX.X.X.XX\lib

Docker for windows:

Docker for windows can be downloaded from below link,


Switch between Windows and Linux containers:

From the Docker for Windows menu, it is possible to toggle which daemon (Linux or Windows) the Docker CLI talks to. Select Switch to Windows containers to use Windows containers or select Switch to Linux containers to use Linux containers (the default).

Please refer below steps to convert HTML to PDF in Linux docker container with ASP.NET Core.

  1. Create a new ASP.NET core application.


  1. Enable docker support and select target OS with Linux.


  1. Install the Syncfusion assemblies and QtBinaries from NuGet package. Please refer below steps to install the Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core package. The above package can be installed from nuget.org


3.1  Right click on the reference and select Manage NuGet Packages… option.


3.2  Then browse and install the Syncfusion.HtmlToPdfConverter.QtWebKit.Net.Core from nuget.org


  1. The installed NuGet package contains the QtBinaries folder. Open the NuGet installed folder and copy the QtBinariesLinux folder to the project folder. Then include the QtBinariesLinux folder in project and set copy always for all QtBinariesLinux assemblies. Please refer below screenshots,


4.1  Below is the screenshot of NuGet package installed location.


4.2  Copy the QtBinariesLinux folder from above location to project folder.

4.3  Then set Copy to output directory to copy always for all the QtBinariesLinux (All files and including inner folders and files) assemblies.


  1. Include the below highlighted line in Dockerfile to install the dependency packages in the Linux docker container for converting HTML to PDF. Please refer below screenshot,

FROM microsoft/aspnetcore:2.0 AS base

RUN apt-get update && apt-get -y install xvfb && apt-get -y install fontconfig && apt-get -y install libssl1.0-dev && apt-get -y 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




  1. Add an Export To PDF button in index.cshtml.


  1. Include below namespace and code snippet in controller for converting HTML to PDF. Please refer below UG link,
  • using Syncfusion.HtmlConverter;
  • using Syncfusion.Pdf;
  • using System.IO;
  • using Microsoft.AspNetCore.Hosting;


  1. Build and Run the sample in docker. It will pull the Linux docker image from the docker hub and run the project.


  1. It will prompt for accessing the windows drives and then the webpage will be opened in browser. Click export to PDF button to convert HTML to PDF in Linux docker container.


  1. Please refer the output PDF screen shot.

Sample can be downloaded from the following link,

Sample: http://www.syncfusion.com/downloads/support/directtrac/general/ze/HTMLtoPDF_DockerLinux1727377528

Article ID: Published Date: Last Revised Date: Platform: Control:
8749 05/15/2018 11/10/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