HTML to PDF converter problem with HTTPS

On my https enabled website, I discovered that when I tried htmlConverter.Convert("https://mywebsite.com/Home") that I just get a blank page in the PDF, but if I do the call with just http:// it works fine. I am using SecuritySwitch, which allowed me to turn off the secure HTTP and so I am able to make it work, but I thought I would post about this issue here in case it comes up for anybody else. I am saving the document to a stream and feeding it to the HttpResponse stream as a download file, in c# here:

string urlToConvert = "http://mywebsite.com/page"; // : this url works, but https://mywebsite.com/page only gives blank page in the PDF
 byte [] pdfData = null;    
 using (PdfDocument document = htmlConverter.Convert(urlToConvert))
 {
     using (MemoryStream memStream = new MemoryStream())
     {
             document.Save(memStream);
             pdfData = memStream.ToArray(); 
      }
 }
// ... continue to feed PdfData to Response...

Bob

5 Replies

PV Prakash Viswanathan Syncfusion Team November 21, 2017 05:41 AM UTC

Hi Robert, 

Thanks for contacting Syncfusion support. 

Our WebKit HTML converter generate blank PDF while converting HTTPS sites without OPENSSL assemblies. For converting HTTPS site our WebKit HTML converter requires OPENSSL libraries. So, we need to install or copy the OPENSSL libraries to the machine where the conversion takes place.  

The below mentioned assemblies can be placed in the Windows system folder (for 64-bit machine, it should be place in $SystemDrive\Windows\SysWOW64 and for 32-bit machine, it should be place in $SystemDrive\Windows\System32), 

  • libeay32.dll
  • libssl32.dll
  • ssleay32.dll

Please below links for prerequisites and trouble shoot the WebKit HTML converter, 

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

Regards, 
Prakash V 



RD Robert Dickow November 21, 2017 07:37 PM UTC

Thanks for the info. This explains the behavior. I did find an excellent solution in my situation to avoid the blank pdf page render without needing OpenSSL. My web app is able to control which resources are referenced via HTTPS and which are not. If secure HTTP is enforced at the server level, such as configuring IIS server to require SSL, then it would definitely require the OpenSSL installation. 


PV Prakash Viswanathan Syncfusion Team November 23, 2017 05:59 AM UTC

Hi Robert, 

Thanks for your update. 
Please let us know if you need any further assistance on this.  

Regards, 
Prakash V 



HS HiQPdf Software November 9, 2022 07:14 AM UTC

Thanks for sharing this problem and its solution. 



WI will January 4, 2023 08:28 AM UTC

How to convert HTML pages into PDF files:

On a Windows computer, open an HTML web page in Internet Explorer, Google Chrome, or Firefox.

Click the “Convert to PDF” button in the Adobe PDF toolbar to start the PDF conversion.

Enter a file name and save your new PDF file in the desired location.


Regards,

Will


Loader.
Up arrow icon