Angular+jspdf: css was not applied
See original GitHub issueI use Angular and nodejs, i want to export the html file into a pdf report, but it doesn’t work correctly.
Are you using the latest version of jsPDF? Yes, with gn-cli, i got the latest version Have you tried using jspdf.debug.js? No Steps to reproduce
import * as jsPDF from 'jspdf';
import * as html2canvas from 'html2canvas';
function export:
const pdf = new jsPDF('p', 'pt', 'a4');
html2canvas(document.body).then((canvas)=>{
pdf.fromHTML(document.body, 10, 10, {pagesplit: true}, () => {
pdf.save('export.pdf');
}
});
What I saw The file is created, but not in good format.
What I expected The same html page in pdf file.
Issue Analytics
- State:
- Created 6 years ago
- Comments:10
Top Results From Across the Web
Exporting PDF with jspdf not rendering CSS - Stack Overflow
To solve this issue, I used Html2Canvas. Just Add HTML2Canvas JS and then use pdf.addHTML() instead of pdf.fromHTML() . Here's my code (no...
Read more >Angular+jspdf: css was not applied · Issue #1518 - GitHub
I use Angular and nodejs, i want to export the html file into a pdf report, but it doesn't work correctly. Are you...
Read more >Exporting PDF with jspdf not rendering CSS - SyntaxFix
I am using jspdf.debug.js to export different data from a website but there are a few problems, I can't get it to render...
Read more >jsPDF HTML TO PDF CSS Tutorial - YouTube
Angular 9 HTML to PDF Using jsPDF and HTML2Canvas Library 2020 · Complete Responsive Blooger Website Using HTML/ CSS · CONVERT HTML To...
Read more >jsPDF table - CodePen
About CSS Base. It's a common practice to apply CSS to a page that styles elements such that they are consistent across all...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hello,
Thank you for your reply, maybe we should use the function addHtml for html with css, but when i tried to use addHtml, there are always some errors. Can you give me an exemple for Angular 4 + jsPDF, please?
I have done it, after doing lot of R&D , their are few steps to follow as below : Install :
npm install jspdf --save
typings install dt~jspdf --global --save
npm install @types/jspdf --save Add following in angular-cli.json:
“scripts”: [ “…/node_modules/jspdf/dist/jspdf.min.js” ] html:
<button (click)=“download()”>download </button>