0

I have spend hours on this and I got no where.

Here is the best combination I have got to.

https://jsfiddle.net/zardaloop/bztoju90/21/

However I can't understand why it is not printing correctly. Does anyone know what I am doing wrong or knows any good solution to this?

window.takeScreenShot = function() {
    html2canvas(document.getElementById("calendar"), {
        onrendered: function (canvas) {
            var doc = new jsPDF({ orientation: 'portrait',format: 'a4' });
            var imgData = canvas.toDataURL("image/jpeg");
            doc.addImage(imgData, 'JPEG', 0, 0, canvas.width, canvas.height);
            doc.save("Print");
        },
        width:800,
        height:600
    });
}
adityajain019
  • 72
  • 1
  • 7
Zardaloop
  • 1,594
  • 5
  • 22
  • 43

1 Answers1

0

Adding the background color to the generated image is enabling the printed pdf with readable content, Still figuring out the rest of the size issue which persists even after changing the orientation: 'landscape'

\\html2canvas(document.getElementById("calendar"), {
    background: '#FFFFFF',   \\Added option
\\  onrendered: function (canvas) {

Update: Modifying the format and orientation is the way I see to debug this. Please keep on trying with the same, for now the below line of code serves your purpose pretty well I believe.

var doc = new jsPDF({ orientation: 'landscape',format: 'a2' });
adityajain019
  • 72
  • 1
  • 7