PDF is blank when using html option
See original GitHub issueI’m using jsPDF and jsPDF autotable in my angular project, when trying to create a pdf from a table the pdf is always blank.
I import the library as follows:
import jsPDF from "jspdf";
import "jspdf-autotable";
import { autoTable as AutoTable } from "jspdf-autotable";
Then declare jsPDF in a variable
pdf = new jsPDF("p", "mm", "a4", true);
My function looks like this
createPdf() {
let table: any;
table = document.getElementById("testTable");
this.pdf.autoTable({
html: table
});
this.pdf.save("myPDF.pdf");
}
and my test table like this
<table id="testTable" style="width:100%">
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>
But when I try to export the table to a pdf it’s just blank.
Any idea?
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to fix a fillable PDF that shows blank fields.
Right click on the PDF. Note: your menu that opens when right clicking may not have all the same options as shown. a....
Read more >PDF is blank when downloading using javascript
You are using a media type "text/pdf"; this is asking for trouble, pdf is not a text format, it is binary, and treating...
Read more >Troubleshoot viewing PDF files on the web - Adobe Support
A blank page in the web browser; A red X icon; A broken-link indicator, ... Locate a PDF on your computer, select it,...
Read more >Blank pages displayed when viewing large PDF - IBM
Troubleshooting scenario 5: PDF displays blank pages when you view a large document · In Adobe Acrobat, select Edit > Preferences. · Select...
Read more >Blank page printing if --header-html option is used · Issue #1593
C:\Program Files\wkhtmltopdf\bin>wkhtmltopdf --header-line --footer-line --head er-html head.html HOM.html test.pdf && test.pdf i used ...
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
I would actually class this as a bug rather than a question. Since it doesn’t work with any table.
This issue has been automatically closed since the issues in this project are mainly used for bugs and feature requests. Questions are directed to stackoverflow.