WebKit & Syncfusion libraries to generate a PDF from Html

I am using the WebKit & Syncfusion libraries to generate a PDF from Html.  I am doing this inside a .NET 4.6 Web Api project.  I have been successful in generating a PDF, however, my included images are not showing. 

Can you please assist?

 screenshot of the code and a snapshot of what the application directory looks like after deployment attached.

Note: how I set the baseUrl value, the “bin\Email\Template\images” folder.

Yet the PDF appears as attached screenshot

The HTML for the image tag is : 

<img src="LogoSalarySolutions.png" width="200" height="29" alt="Salary Solutions" /> 

thanks

 

 


Attachment: Syncfusion_forum_a13c7c0c.zip

3 Replies

PV Prakash Viswanathan Syncfusion Team May 30, 2018 11:01 AM UTC

Hi Indika, 

Thanks for contacting Syncfusion support. 

While converting HTML string to PDF, we internally save the HTML string to a file in temporary folder and then we will make use of the file for further conversion. While saving the intermediate HTML file, we insert a BASE HREF tag in HTML with the provided base URL. During the conversion, the resources will be load from the given base URL location.  

We have checked the reported image missing issue with the provided code snippet. This is occurring due to the incomplete base URL (slash is missing at the end of the path). Please use below code snippet to set baseURL. 

//Get base URL of the resources 
string baseUrl = Server.MapPath("~/bin/Email/Templates/Images/"); 

Please refer below links for more information about base URL. 

We have attached sample for converting HTML string to PDF with image, please find the sample from below link, 
 
Regards, 
Prakash V 



IE Indika Ediriwickrama May 31, 2018 01:06 AM UTC

 thanks, it worked.  I have a follow-up question 

Last week I downloaded the free trail version of these libraries to trial HTML to PDF conversion.  I am including these libraries in the deployment of our software.

Syncfusion.Compression.Base.dll
Syncfusion.HTMLConverter.Base.dll
Syncfusion.Pdf.Base.dll
Syncfusion.WebKitHtmlConverter.Base.dll

I own a full license for Syncfusion (Global License Order Number : S396699)

 Do I need to do anything with my current trail libraries?  Or is it the same version of the DLL’s that I downloaded for the trial as you would download for the licensed version?

and also Currently I have included all these QtBinaries files in my deployment and they total about 60mb. 

For HTML to PDF conversion, do I require all of them?

Will it work with a smaller subset deployed in my ASP.NET Web API solution?


Thanks


Attachment: Syncfusion_forum_3a05cf1b.zip


PV Prakash Viswanathan Syncfusion Team May 31, 2018 11:59 AM UTC

Hi Indika, 
 
Please find the detail below, 
 
Query 
Response 
Do I need to do anything with my current trail libraries?  Or is it the same version of the DLL’s that I downloaded for the trial as you would download for the licensed version? 
There is no difference between Syncfusion trial libraries and licensed libraries. You can use same version of the libraries for your development.  
 
Also, you need to register the Syncfusion License key using Syncfusion License Manager utility from the Syncfusion Control Panel. Please refer the below documentation link for more information. 
 
Currently I have included all these QtBinaries files in my deployment and they total about 60mb.  
For HTML to PDF conversion, do I require all of them? 
 
Will it work with a smaller subset deployed in my ASP.NET Web API solution? 
Yes, HTML to PDF conversion requires all QtBinaries assemblies. If all QtBinaries are available, then the conversion will be working fine in the application.  
 
Please let us know if you need any further assistance on this. 
 
Regards, 
Prakash V 


Loader.
Up arrow icon