I have a partial view with its own bootstrap reference which renders well when loaded on the browser (on its own). I'm taking this partial view and pre-rendering it to an HTML string which includes the external CSS files. I've tried with local stylesheet, CDN and even putting the specific styles inline with a style tag but not even the basic bootstrap column styles are applied. This is how my HTML converter looks like with a sample HTML string:
string htmlStr = "
HtmlConverter htmlConv = new HtmlConverter
AutoDetectPageBreak = true,
EnableHyperlinks = true,
HtmlToPdfResult result = htmlConv.Convert(htmlStr, string.Empty, ImageType.Metafile, (int)width, (int)height, AspectRatio.KeepWidth);
PVPrakash Viswanathan Syncfusion Team May 6, 2019 02:21 AM
Hi Juan Jiminez,
Thank you for contacting Syncfusion support.
The sample from this page is using IE rendering engine for converting HTML to PDF, we can specify the base URL when converting HTML string to PDF. Please make sure the HTML string is displayed properly in IE browser by saving it as a HTML file. Also, try the conversion with file URL to PDF instead of HTML string, so that you can compare the PDF document with input HTML file in IE browser.
Syncfusion provides HTML to PDF conversion support using WebKit, Blink and IE rendering engine, please refer below links for comparing the rendering engines. Kindly try the WebKit/Blink rendering engines which supports many features and it will generated PDF documents as like how the HTML file is displayed in web browsers.
If you are using IE rendering engine for any specific reason, please provide more details such as complete code snippet, input HTML string, output PDF document etc, to reproduce the issue in our end. So that it will helpful for us to analyze and assist you further on this.
JJJuan JiminezMay 6, 2019 12:28 PM
Webkit converter is way better. Thanks for pointing me in the right direction.
PVPrakash Viswanathan Syncfusion Team May 6, 2019 11:53 PM
Hi Juan Jiminez,
Thank you for your update.
Please let us know if you need any further assistance on this.