jsPDF.html output very large fields in document.
See original GitHub issueHello there, i’ve been trying the jsPDF.html function, but it seems its outputting the html but in such large scale that it is unreadable. Am I doing something wrong? I’ve been using the lines from the documentation itself in my componnent. I am actually working with vue.js.
methods: {
download() {
var html =
`<body>
<h1>This is Title</h1>
<div>
<p>this is test no.1</p>
</div>
<div>
<p><b>This is test no.1</b></p>
</div>
<div>
<p>This is test no.3</p>
</div>
</body>`;
var doc = new jspdf();
doc.html(html, {
callback: function (doc) {
doc.save();
},
});
},
},
The code results its this file: generated.pdf
Issue Analytics
- State:
- Created 3 years ago
- Comments:19 (2 by maintainers)
Top Results From Across the Web
jspdf forces pdf to fit in one place, but my pdf has a very large ...
I have a table that has 3 columns slno, name, age. Design your table according to your need. · If you have a...
Read more >jsPDF Demos
Examples for using jsPDF with Data URIs below. Go back to project homepage. Basic elements; Text elements; Graphic elements. Simple two-page text document....
Read more >jsPDF AutoTable example – Table to PDF - Phppot
By parsing the HTML table source, it outputs a PDF document that can be downloaded and saved. function generateTable() { var doc =...
Read more >jsPdf not working in Visualforce page for large documents
Here the jsPdf method is working for small sized document alone. For documents with more content its not responding. Do anyone know about...
Read more >Generate PDF at Client Side with jsPDF plugin – Part 3
What if my table data is too long and it is displayed wrapped on frontend side. ... We just have to keep this...
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 FreeTop 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
Top GitHub Comments
Solved the issues by adding this by adding wrapper div and css width in px. It work for me
You should specify some options. For example i am using
const doc = new jsPDF('p', 'px', 'a3', true);
while my content is set to width of 500px (centered). This is work for me perfectly. You should look at jsPDFOptions (Image Below) and just play with it. Only tricky option is format. format - It’s default page format. It can be “a3”, “a4” (default), “a5”, “letter”, “legal”. and also format can take array of 2 numbers ex: [2, 5]. you can look here for this - https://stackoverflow.com/questions/23104008/where-to-change-default-pdf-page-width-and-font-size-in-jspdf-debug-js