Hello,
I am getting "Xvfb failed to start" error at at Syncfusion.HtmlConverter.HtmlConverter.ConvertHtmlToPdf(String url, Int32 width, Int32 height, String tempFile)
My environment:
Ubuntu 20.04
.NetCore 3.1
Syncfusion PDF 20.2.0.40
Running the code remotely using VSCODE with application port 5000 forwarded to localhost:5000.
Here's output from installing all dependencies:
xxxx@vulcan:~/repos/xxx$ sudo apt-get update
[sudo] password for xxxx:
Hit:1 http://us.archive.ubuntu.com/ubuntu focal InRelease
Hit:2 http://us.archive.ubuntu.com/ubuntu focal-updates InRelease
Hit:3 https://packages.microsoft.com/ubuntu/20.04/prod focal InRelease
Hit:4 http://us.archive.ubuntu.com/ubuntu focal-backports InRelease
Hit:5 http://us.archive.ubuntu.com/ubuntu focal-security InRelease
Get:6 https://pkgs.tailscale.com/stable/ubuntu focal InRelease
Fetched 6,575 B in 1s (6,492 B/s)
Reading package lists... Done
xxxx@vulcan:~/repos/xxx$ sudo apt-get install xvfb
Reading package lists... Done
Building dependency tree
Reading state information... Done
xvfb is already the newest version (2:1.20.13-1ubuntu1~20.04.17).
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.
xxxx@vulcan:~/repos/xxx$ sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version (1.1.1f-1ubuntu2.23).
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.
xxxx@vulcan:~/repos/xxx$ 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
Reading package lists... Done
Building dependency tree
Reading state information... Done
libxcb-icccm4-dev is already the newest version (0.4.1-1.1).
libxcb-image0-dev is already the newest version (0.4.0-1build1).
libxcb-keysyms1-dev is already the newest version (0.4.0-1build1).
libxcb-randr0-dev is already the newest version (1.14-2).
libxcb-render-util0-dev is already the newest version (0.3.9-1build1).
libxcb-render0-dev is already the newest version (1.14-2).
libxcb-shm0-dev is already the newest version (1.14-2).
libxcb-util0-dev is already the newest version (0.4.0-0ubuntu3).
libxcb-xfixes0-dev is already the newest version (1.14-2).
libxcb-xkb-dev is already the newest version (1.14-2).
libxcb1-dev is already the newest version (1.14-2).
libxfixes-dev is already the newest version (1:5.0.3-2).
libxrandr-dev is already the newest version (2:1.5.2-0ubuntu1).
libxrender-dev is already the newest version (1:0.9.10-1).
libx11-dev is already the newest version (2:1.6.9-2ubuntu1.6).
libx11-xcb-dev is already the newest version (2:1.6.9-2ubuntu1.6).
0 upgraded, 0 newly installed, 0 to remove and 74 not upgraded.
🙏 Many thanks in advance for your help.
failed to start
Hi Mark,
Thank you for reaching out to Syncfusion support.
We have checked your issue on our end. Upon further analysis, it seems that you are using QtWebkit rendering engine to perform HTML to PDF conversion in Ubuntu 20.04. The WebKit rendering engine internally uses the QtWebKit browser to perform HTML to PDF conversion. It is a legacy rendering engine, that has some known rendering issues and limitations, some of the advanced Bootstrap CSS styles are not supported. So we strongly recommended to use our blink rendering engine to perform HTML to PDF conversion.
And also you are using .Net Core 3.1 version of project which is no longer supported so the conversion failed in your case. So we strongly recommended to use latest version of .NET to get exact result. We have attached the supported version and non-supported version of .NET
However, we have created .NET 8 console application to perform HTML to PDF conversion using Blink rendering engine in Ubuntu 20.04 as steps mentioned in the below UG documentation.
UG: https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/linux
You can find sample and output document below for your reference.
Sample: HTML-to-PDF-Net8-Linux-584211680
Output: HTML-to-PDF-872004969
Please try the above sample and let us know the result. Kindly get back to us if you need further assistance.
Regards,
Arumugam M
Hello,
Many thanks for your reply. This is a large legacy application and I am unable to upgrade it to the latest SDK at this time. I have it running successfully on several other servers using Docker. There's something different about this particular environment which I cannot pinpoint. I tried to install everything that is referenced in my Dockerfile. Any other suggestions would be very much appreciated. Could this have anything to do with SSL? I am running the app using https://localhosts:5000.
Hi Mark,
We have checked your issue on our end. Currently, we are working on creating the application .NETCore 3.1 in Ubuntu 20.04 to replicate the reported issue. We will update further details on August 28th, 2024
Regards,
Arumugam M
Hi Mark,
We have checked your issue on our end. Upon further analysis, we have created ASP .NET MVC .NETCore 3.1 application in Ubuntu 20.04. The HTML to PDF is working fine on our end with the package version 20.2.0.40 in Ubuntu 20.04. We kindly request you to ensure that your machine has prerequisites installed as mentioned in the below documentation
UG: https://help.syncfusion.com/document-processing/pdf/conversions/html-to-pdf/net/webkit#prerequisites-for-linux
However, we have attached the sample and output document below for your reference
Sample: HtmlToPdfSampleMVC1320624749
Output: Output_(12)-2135495996
Please try the above sample and let us know the result. Kindly get back to us if you need further assistance.
Regards,
Arumugam M
Hello,
Thanks for your reply. This is what I am getting trying to install libssl1.0-dev:
$ sudo apt-get install libssl1.0-dev
[sudo] password for xxxxxxx:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package libssl1.0-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package 'libssl1.0-dev' has no installation candidate
$ sudo apt-get install libssl-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
libssl-dev is already the newest version (1.1.1f-1ubuntu2.23).
0 upgraded, 0 newly installed, 0 to remove and 70 not upgraded.
Also, now when I generate the PDF, a blank is created, no errors or warning.
Hi Mark,
We have checked your issue on our end. We suspect that the reported issue may occur due to 'libssl1.0-dev' is no longer available for recent Ubuntu versions. Ubuntu now uses newer versions of OpenSSL which is libssl-dev for version 1.1.1. You can find the command below to install OpenSSL libraries
sudo apt-get install libssl-dev |
It provides the necessary files for compiling against OpenSSL version 1.1.x. The below highlighted result occur due to pending upgrades. You could run 'sudo apt-get upgrade' to ensure all your packages are up to date, which might resolve any related issues.
Please try the above solution and sample shared in the last response and let us know the result. Kindly get back to us if you need further assistance.
Regards,
Arumugam M
Hello,
I ran your sample project and it worked as expected. This tells me that my environment has all the required dependencies installed. I did notice that you project has SSL folder with 2 files: libcrypto.so and libssl.so. I don't have this in my project. What is the significance of the SSL folder and how is it being referenced?
Here's my code for your reference:
Hello,
Thanks to your help and pointers, I was able to figure out that my issue was file permission related. I switched from using a url to file path when doing the conversions. Many thanks again!
Hi Mark,
Thanks for the update. We are glad to hear that reported issue has been resolved on your end. Kindly get back to us if you need any further assistance.
Regards,
Arumugam M