Using Syncfusion HtmlToPdfConverter on Debian 11

I'm developing an ASP.NET 6 app which will convert a web page to a PDF file, which will then be attached to an email.

I've set up a simple app at this point which can produce a PDF from https://google.com and it works well using the WebKit render engine under Windows using Visual Studio 2022, Windows 11, and NET 6.0.

The app once completed will run under Debian Linux and to this end I test my code on WSL2 and a VM both running Debian. I've followed the Prerequisites for Linux and I'm using the NuGet package to provide the WebKit engine.

The issue I'm having is that under WSL2 I get the flowing error:

Syncfusion.Pdf.PdfException: 'This application failed to start because it could not find or load the Qt platform plugin "xcb".

Available platform plugins are: minimal, offscreen, xcb.

Reinstalling the application may fix this problem.

Aborted

And using the Debian VM the code works but I only get a blank page.

Has anybody got any experience using the converter under Linux?


5 Replies 1 reply marked as answer

GK Gowthamraj Kumar Syncfusion Team September 27, 2022 11:16 AM UTC

Hi Adrian,


Our WebKit/Blink rendering engine supports conversion in Debian based Linux OS. The reported exception may occur due to missing of prerequisites and dependent packages, kindly ensure that all the dependent packages are installed in the machine.


Please refer to the below link for dependency packages for converting HTML to PDF in Linux. 

Prerequisiteshttps://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/webkit#prerequisites-for-linux 

Troubleshooting - https://help.syncfusion.com/file-formats/pdf/converting-html-to-pdf#troubleshooting   

KBhttps://www.syncfusion.com/kb/8749/how-to-convert-html-to-pdf-in-linux-docker-container
Blogshttps://www.syncfusion.com/blogs/post/html-to-pdf-conversion-using-asp-net-core-in-linux-docker.aspx  


Please refer below dependency packages, 

  1. apt-get update
  2. apt-get install xvfb
  3. Need to add OPENSSL shared objects files in QtBinariesLinux folder. (attached the files in below link)
  4. 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 reported blank page may occurs due to missing of openssl libraries. We have attached a required OPENSSL (libssl) shared objects, can you please add these files in the QtBinariesLinux folder. Then try the conversion with .net 5.0/.net 6.0 and let us know the result. Please find the libssl files from the below link,  


LIBSSL: https://www.syncfusion.com/downloads/support/directtrac/general/ze/SSL109500829

  • Download and extract the file from the above link.
  • Copy the libcrypto.so and libssl.so files to QtBinariesLinux folder.
  • Then try the conversion and check the resultant PDF document.


Please let us know if you need any further assistance in this.


Regards,

Gowthamraj K


Marked as answer

AD aderrose replied to Gowthamraj Kumar September 27, 2022 12:33 PM UTC

Hi,

Thanks for the response, the note about the missing OpenSSL libraries looks to be the answer.

I have manually copied those files and I can now get the WebKit engine to render a PDF correctly.

I've checked the official manual downloads for the HTML Converter (https://www.syncfusion.com/account/downloads) and the contents of the NuGet package and these two files are missing in both, I've installed all the dependencies as per the instructions in Prerequisites for Linux which one exception as libssl1.0-dev is not available under either Debian 11 or Ubuntu 22.04, I used libssl-dev instead, could this be the issue?

Also, each time I update the NuGet packages I'm guessing I will need to reinclude the missing files, could they be included in future releases?



GK Gowthamraj Kumar Syncfusion Team September 28, 2022 12:34 PM UTC

Hi Adrian,


The libssl1.0-dev package is not supported in Linux from .net 5.0 platforms, so we need to include those OpenSSL file to render the HTTPS sites to PDF conversion. Our WebKit rendering engine becomes an older rendering engine, we do not have any plan to include this library. We introduced a new Blink rendering engine, which supports the latest bootstrap styles and advanced web features. We are fully focused on this and suggested the blink rendering engine. Blink rendering engine does not have OPENSSL dependency. Blink converter internally makes use of chromium executable in headless mode for converting HTML to PDF. It will preserve the PDF document like how the input HTML is displayed in chromium-based web browsers (chrome print preview).


Please refer below link for more information about Blink rendering engine.

Blink: https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink

https://help.syncfusion.com/file-formats/pdf/convert-html-to-pdf/blink#prerequisites-for-linux

https://help.syncfusion.com/file-formats/pdf/converting-html-to-pdf#supported-and-unsupported-features-by-rendering-engines


Please let us know if you need any further assistance in this.


Regards,

Gowthamraj K



AD aderrose September 28, 2022 12:48 PM UTC

Hi,

Thanks for the reply again, having got the WebKit engine running by including the missing OpenSSL files it quickly became clear that the engine won't render Bootstrap sites very well and this is a requirement for me.

I quickly set up a Blink version of my code this morning for comparison and it confirms your reply, it does a better job of rendering a page especially if Bootstrap is used.

Thanks for the advice so far and might I suggest that something is put into the documentation so that if you are targeting the current version of .NET that the Blink engine is the preferred route for development, especially when .NET 6 is an LTS release, and the only other supported .NET release is 3.1 which will be out of support by the 13th of December this year.

Regards,

Adrian Rose.



GK Gowthamraj Kumar Syncfusion Team September 29, 2022 07:01 AM UTC

Hi Adrian,


As we said earlier, we are moving into the Blink rendering engine by default and we have already provided blink support in .net 6.0 platforms. Also, we are working to change the Html to PDF UG documentation with the blink engine.


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


Please let us know if you need any further assistance in this.


Regards,

Gowthamraj K


Loader.
Up arrow icon