Skip to content

Commit 0fd687a

Browse files
author
Mohamed Ibrahim
committed
fix pdf canvas width and height problem
1 parent 087c2a4 commit 0fd687a

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/angular-pdf.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222

2323
var setCanvasDimensions = function(canvas, w, h) {
2424
var ratio = backingScale(canvas);
25-
canvas.width = Math.floor(w); //removed the ratio because it was problematic for browser zooming
26-
canvas.height = Math.floor(h);
27-
canvas.style.width = Math.floor(w) + 'px';
28-
canvas.style.height = Math.floor(h) + 'px';
25+
canvas.width = Math.floor(angular.element(window).width()); //removed the ratio because it was problematic for the pdf size
26+
canvas.height = Math.floor(angular.element(window).height());
27+
canvas.style.width = canvas.width + 'px';
28+
canvas.style.height = canvas.height + 'px';
2929
canvas.getContext('2d').setTransform(ratio, 0, 0, ratio, 0, 0);
3030
return canvas;
3131
};
@@ -222,3 +222,4 @@
222222
};
223223
} ]);
224224
})();
225+

0 commit comments

Comments
 (0)