The latest version of html2canvas make wrong screenshots
See original GitHub issueWhen I use the new version of html2canvas( http://html2canvas.hertzen.com/dist/html2canvas.min.js ) i obtain a bad screenshot, but if i use another version i obtain a good screenshot. Like you can see in the example above, the image is posted down that it should be post, and the down part is cropped. (I let bigger to show that the image is cropped and don’t start since the beggining)
the code:
html2canvas(document.querySelector('#portaCanvas')).then( canvas => { let pdf = new jsPDF('p', 'mm',[8650,12900]); //10 times more to show that the image is cropped at the end pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0); //the screenshot have a blank space above pdf.save(filename); })
When I use a version before it work good. (This have not space in blank around because it’s not necessary)
the code:
html2canvas(document.querySelector('#portaCanvas'),{ onrendered: canvas => { let pdf = new jsPDF('p', 'mm',[865,1290]); pdf.addImage(canvas.toDataURL('image/png'), 'PNG', 0, 0); pdf.save(filename); } });
I need to use the new version to can scale it but i face to with this issue
Issue Analytics
- State:
- Created 4 years ago
- Comments:8
Top GitHub Comments
@VenkatSarvesh The 0.4.1( https://cdnjs.com/libraries/html2canvas ), but in that version the attribute scale isn’t supported. So, the screenshot is blurred and if there is images it look worst.
Try to add scrollY:-window.scrollY to the options in 1.0.0-rc.5 version, that could help you with your problem
This look like it solve my problem https://github.com/niklasvh/html2canvas/issues/1979#issuecomment-527775450
add a
if(screen.width < 1024) { document.getElementById("viewport").setAttribute("content", "width=1200px"); }
To change the content of the viewport seems to work