admin管理员组文章数量:1394198
I have a requirement Where I need to generate a PDF file which consists of table. I am able to generate PDF. But, I want to apply styles to border. Currently the border is showing black in color. I want to change the color to white. Ho do I do that??
Here is my js function which is called when "Export to PDF" link is clicked.
For tableId
I am passing my table name.
My table is as shown:
My PDF Generated is as shown:
I want to change the border color of my generate PDF to "grey". How am I supposed to do that? Can anyone please help me with this?
I have a requirement Where I need to generate a PDF file which consists of table. I am able to generate PDF. But, I want to apply styles to border. Currently the border is showing black in color. I want to change the color to white. Ho do I do that??
Here is my js function which is called when "Export to PDF" link is clicked.
For tableId
I am passing my table name.
My table is as shown:
My PDF Generated is as shown:
I want to change the border color of my generate PDF to "grey". How am I supposed to do that? Can anyone please help me with this?
Share Improve this question edited Jul 1, 2019 at 5:57 Shruthi Sathyanarayana asked Mar 8, 2017 at 7:16 Shruthi SathyanarayanaShruthi Sathyanarayana 2112 gold badges4 silver badges14 bronze badges1 Answer
Reset to default 3Before calling cell()
method you have to set drawColor
property.
To set draw color use setDrawColor
method
setDrawColor(R,G,B);
More details about this method are here in the API documentation. http://rawgit./MrRio/jsPDF/master/docs/global.html#setDrawColor
The draw color can be reset to black by setting the RGB value to
setDrawColor(0);
Example:
//Set text color
doc.setTextColor(0);
doc.text(10, 10, 'This is a test');
//Change text color
doc.setTextColor("#42d254");
//Set draw color
doc.setDrawColor(150,150,150);
doc.cell(40, 40, 50, 20, "cell"); //cell(x,y,w,h,text,i)
Check this fiddle for reference: https://jsfiddle/Purushoth/x4xo4owj/
Please checkout jsPDF-Autotable plugin which has lot of built-in features for custom styling https://simonbengtsson.github.io/jsPDF-AutoTable/#header-footer.
本文标签: javascriptHow to apply css for pdfcell in JSPDFStack Overflow
版权声明:本文标题:javascript - How to apply css for pdf.cell in JSPDF - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744565918a2613044.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论