WebKit Converter blank page

Hi,

I'm workink with HtmlToPdfConverter to create a invoice PDF.
I have this invoice in HTML and work very well, but when I try converter dont work. 

I try another https pages  and work well, but in my site don't work.
I tried these web pages:
  • https://www.google.com.br
  • https://www.microsoft.com.br
I use Azure Web Apps and Blazor and I try converter others azure websites and worked very well.

I have OPENSSL in my project too.

My code:

MemoryStream stream = new MemoryStream();
//Initialize HTML to PDF converter
HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter();
WebKitConverterSettings settings = new WebKitConverterSettings();
//Set WebKit path
settings.WebKitPath = Startup.contentRootPath + @"\Biblio\QtBinariesDotNetCore\";
//Assign WebKit settings to HTML converter
settings.AdditionalDelay = 3000;
htmlConverter.ConverterSettings = settings;
//Convert HTML to PDF.
string url = "https://webclient.irineu.dev.sic360.com/";
PdfDocument document = htmlConverter.Convert(url);
 
 
//Save and close the document instance.
document.Save(stream);
document.Close(true);
stream.Position = 0;

4 Replies 1 reply marked as answer

GK Gowthamraj Kumar Syncfusion Team January 27, 2021 02:06 PM UTC

Hi Thomaz, 
 
Thank you for contacting Syncfusion support. 
 
When converting HTTPS sites, blank paged PDF may occur due to the missing of the OPENSSL assemblies in the Azure website. To convert HTTPS sites, the converter requires OPENSSL assemblies. By default, some Azure websites do not have the OPENSSL assemblies. So, these assemblies should be added to the website explicitly. We could not place the assemblies in the system drive on the Azure App service environment. Refer to the below steps to place the OPENSSL assemblies in Azure for converting HTTPS sites to PDF.    

  1. Create a new folder in a project and copy the OPENSSL assemblies to that folder.
  • libeay32.dll
  • libssl32.dll
  • ssleay32.dll
  1. Include that folder in a project and set copy to the output directory as “Copy always”.
  2. Get the path of the OPENSSL assemblies folder in C# and set it to the environment variable.
 
Refer below link for more information about adding OPENSSL assemblies in Azure. 
 
If still, you are facing the same issue, kindly please provide us the below details to reproduce the issue on our end. So, that it will be helpful for us to analyze and provide you the solution at the earliest.   
   
  • Azure subscription details and published profile details (Region, Size, hosting plans, etc.,),
  • Simple sample with steps to reproduce the issue.
  • Produce version.
 
Regards, 
Gowthamraj K 



TL Thomaz Lima January 27, 2021 02:30 PM UTC

Hi,

My azure region is East US, hosting plans B1.

How I said before it's worked with others website, but with this Blazor website not.
Do you can make a sample for me? A Blazor Server App where use net  5.0 and convert html to pdf

My code is on first message.

Regards


SL Sowmiya Loganathan Syncfusion Team January 28, 2021 02:32 PM UTC

Hi Thomaz, 

Thank you for your update. 

We were able to reproduce the reported “Blank page issue occurs while converting particular URL to PDF using WebKit” in our end. Currently, we are validating on this and we will update the further details on February 01, 2021.  

Regards, 
Sowmiya L 
 



GK Gowthamraj Kumar Syncfusion Team February 2, 2021 03:23 PM UTC

Hi Thomaz, 

Thank you for your patience. 

As we said earlier, to access the resource from HTTPS site, the HTML converter requires OPENSSL assemblies. By default, some Azure websites do not have the OPENSSL assemblies. So, these assemblies should be added to the website explicitly. Please refer below links to add OPENSSL assemblies to Azure website.   

We have created a sample for converting provided URL to PDF using WebKit in Azure, it is generate a login page properly as it looks like in web browsers. We have attached the runnable sample, host link and output document for your reference. Kindly please try the sample in your end and let us know the result. 


Note: The above hosted link will be expired in two days. In this host link, click html to pdf button to generate PDF document. 

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

Regards, 
Gowthamraj K 


Marked as answer
Loader.
Up arrow icon