We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

HTML with iframe to PDF WebKit

Does anyone have an example of creating a PDF of an HTML page that has an iframe using c#?

5 Replies

GK Gowthamraj Kumar Syncfusion Team November 20, 2019 08:33 AM UTC

Hi Doug, 

Thank you for using Syncfusion products. 

We have created a simple sample to convert the HTML file (with iframe) into PDF document using WebKit HTML converter. Kindly try the below sample in your end and let us know the result if it suites your requirement. Please find the sample and output document from below link, 

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

Regards, 
Gowthamraj K 



DS Doug Simpson November 20, 2019 02:06 PM UTC

Thank you Gowthamraj. I am currently using a trial version of Syncfusion. We're evaluating Syncfusion components.  The attached is what I get when I run the code provided. Your code appears to use the .Net Framework, but we would prefer to use .Net Standard or Core. Is there a fully working trial version of the Syncfusion Essential PDF components?

Attachment: HtmlToPDF_c03adeec.zip


GK Gowthamraj Kumar Syncfusion Team November 21, 2019 11:29 AM UTC

Hi Doug, 

Thank you for your update. 

We have created a simple sample to convert the HTML file (with iframe) into PDF document using WebKit in Net Core. Kindly try the below sample in your end and let us know the result if it suites your requirement. Please find the sample and output document from below link,  

Note: Yes, all the features are supported in both trial and license version.  

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

Regards, 
Gowthamraj K


DS Doug Simpson November 21, 2019 01:48 PM UTC

Thank you Gowthamraj. I built an xunit test library yesterday with code similar to what you provided and was able to get it working. The iframe is PowerBI embedded and may be the issue. If the iframe source is a local file or epa.gov, then the PDF renders non-blank. If the iframe source is PowerBI embedded or a site like apple.com, then the PDF is blank.


GK Gowthamraj Kumar Syncfusion Team November 22, 2019 01:31 PM UTC

Hi Doug, 

Thank you for your update. 

We have checked the conversion with powerbi and apple sites and the converter generates PDF document. We internally make use of Qt WebKit rendering engine for converting HTML to PDF. WebKit rendering engine preserves the output PDF document like how the input HTML file/URL is displayed on the WebKit based web browsers (safari), those sites are not loaded inside a iframes in web browser itself. The same behavior as replicates in our converter. We have attached a screenshot of the simple webpage view in safari browser for your reference. 

We have attached the documents with iframe for your reference.  

 

On further analysis about this loading issue, some websites (power bi, apple, yahoo etc.,) are does not allowed their site to displayed inside a iframes, for the purpose of protecting the security of information we entered in that website, the publisher of the site does not allow to displayed inside a frame.  

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

Regards, 
Gowthamraj K 


Loader.
Live Chat Icon For mobile
Up arrow icon