.html() function bug
See original GitHub issueI am using jsPDF module in angular 7 for rendering my page to a new pdf file. Here is some code snippets you can check.
@ViewChild('pdf') pdf: ElementRef;
var doc = new jsPDF('p', 'pt', 'a4');
const pdfTable = this.pdf.nativeElement;
doc.html(pdfTable, {
callback: function(doc) {
doc.save('tableToPdf.pdf');
}
});
and here is the div element i was trying to render for testing.
<div class = "pdf" id="pdf" #pdf>
<label>test</label><br>
<label>test</label><br>
<label>test</label><br>
<label>test</label><br>
<label>test</label><br>
<label>test</label><br>
<label>test</label><br>
<label>test</label><br>
</div>
the problem is that when the div content is over one page, pdf shows a strange margin on the top of the first page. I have attached a screenshot for some insights. screenshot
For some reasons, I must use html function and i can’t use other functions such as addHTML() or fromHTML().
Why do i have this strange margin? Is there any solution to avoid this issue?
Please help me if you have some solutions. Thanks in advance.
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (1 by maintainers)
Top Results From Across the Web
Jquery html() bug? - javascript - Stack Overflow
Jquery html() bug? ... In IE8, how come when I press the "press" button, the h2 with black background turns to white background...
Read more >Bugs and Errors :: Eloquent JavaScript
The process of finding mistakes—bugs—in programs is called debugging. ... function canYouSpotTheProblem() { "use strict"; for (counter = 0; counter < 10; ...
Read more >What went wrong? Troubleshooting JavaScript - MDN Web Docs
In this case, the code was not run and the error was not thrown until the checkGuess() function was run by line 86....
Read more >html helper function bug · Issue #126 · rstudio/gt · GitHub
html helper function recycles input value tab_1 <- exibble ... @olegursu What you have is pretty close but you actually need the text_transform()...
Read more >6559 (.html() function returns inconsistent results) – jQuery
#6559 closed bug (worksforme) .html() function returns inconsistent results ... The html contents of the div element were returned. b is invalid markup....
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
We are currently working on making the
html
function work again - stay tuned. Meanwhile you can try using html2canvas 1.0.0-rc1 instead of rc5.If it’s any help, I had more success with getting HTML into a PDF with html2pdf (which uses jsPDF) than I did by putting it straight into jsPDF.