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?
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.
Prerequisites: https://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
KB: https://www.syncfusion.com/kb/8749/how-to-convert-html-to-pdf-in-linux-docker-container
Blogs: https://www.syncfusion.com/blogs/post/html-to-pdf-conversion-using-asp-net-core-in-linux-docker.aspx
Please refer below dependency packages,
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
Please let us know if you need any further assistance in this.
Regards,
Gowthamraj K
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?
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
Please let us know if you need any further assistance in this.
Regards,
Gowthamraj K
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.
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