Skip to Content

SAPUI5 sap.ui.core.HTML download content to pdf

Hi Expert,

Continue with my work on below question, how could I able to download the content of the HTML into pdf format?

sap.m.table css grid

HTML Content

Thanks.

Regards,

-Ben

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jan 18 at 03:54 AM

    Hi Yen Shen, Ben Lim,

    There are open source third party libraries available for this purpose. You can use jsPDF, just visit this link, there an working example is given on how to generate an PDF file. For more information, visit this link.

    Hope this helps,

    Regards,

    Arjun Biswas.

    Add comment
    10|10000 characters needed characters exceeded

    • Hi,

      I've found my solution by adding below code without 3rd party library:

      However, my css style is not included in the pdf output. Instead of hard coded the css by writing <style></style> tag, how could I generate the output with CSS?

      var ctrlString = "location=1,status=1,scrollbars=1,width=1000,height=1000";
      var wind = window.open("", "PrintWindow", ctrlString);     
      wind.document.write(htmlStringContent);
      wind.print();
      wind.close();
      

      Regards,

      -Ben-