Script File is not executed in PDF file

Hi, I am still new to Syncfusion here. Currenly I've done a table with a script (document.ready) function to merge the table cells with similar values. The table have been displayed on Google Chrome successfully with my localhost and the columns of the table containing similar values have been merged successfully as well. A function of generating the webpage to PDF works successfully, but the columns of the table displayed on the PDF file do not merge, so I assume that the script file is not rendered in my PDF function.

This is my PDF Function:
  private void printpdf()
        {
            //Initialize HTML to PDF converter 
            HtmlToPdfConverter htmlConverter = new HtmlToPdfConverter(HtmlRenderingEngine.WebKit);
            WebKitConverterSettings settings = new WebKitConverterSettings();
            //Set WebKit path
            settings.WebKitPath = Server.MapPath("~/QtBinaries");
            settings.EnableJavaScript = true;
            settings.AdditionalDelay = 5000;
            //Assign WebKit settings to HTML converter
            htmlConverter.ConverterSettings = settings;
            //Get the current URL
            string url = HttpContext.Current.Request.Url.AbsoluteUri;
            //Convert URL to PDF
            Syncfusion.Pdf.PdfDocument document = htmlConverter.Convert(url);
            //Save the document
            document.Save("Output.pdf", HttpContext.Current.Response, HttpReadType.Save);
        }

This is my Script Function on aspx file:
         
                $(document).ready(function () {
                    -
                    -
                    -
                 };
         



3 Replies

GK Gowthamraj Kumar Syncfusion Team April 30, 2020 03:04 PM UTC

Hi Alan,  

Thank you for contacting Syncfusion support.   

WebKit rendering engine will preserve the PDF document like how the input HTML file displayed on WebKit (example, safari) based web browsers. So, kindly ensure the preservation of your webpage on WebKit based browser. If it is not possible, kindly share us the complete HTML file (save the webpage from web browser and share the complete HTML file with styles, scripts etc.,) to us. So, that it will be helpful for us to analyze and assist you further on this.  

If your web page is rendering properly in chrome browser, kindly try our latest Blink rendering engine for the conversion. It will preserve the output PDF document like how the input HTML is displayed on chromium based browsers. Please refer below link for more information,  

Regards, 
Gowthamraj K 



AL Alan Low May 2, 2020 04:09 AM UTC

Thank you so much for replying and thank you so much! It works now! Thanks a lot! :) 


PV Prakash Viswanathan Syncfusion Team May 4, 2020 05:18 AM UTC

Hi Alan, 

Thank you for the update.  
Please let me know if you need any further assistance on this. 

Regards, 
Prakash V 


Loader.
Up arrow icon