Skip to Content
0

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

Jan 18 at 02:46 AM

85

avatar image

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

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Arjun Biswas Jan 18 at 03:54 AM
0

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.

Show 1 Share
10 |10000 characters needed characters left 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-

1