Skip to content

Commit f87de58

Browse files
committed
fix scaling issue
1 parent 886fef0 commit f87de58

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,11 @@ var ReactToPdf = function (_PureComponent) {
5555
if (!targetComponent) {
5656
throw new Error('Target ref must be used or informed. See https://github.com/ivmarcos/react-to-pdf#usage.');
5757
}
58-
(0, _html2canvas2.default)(targetComponent, { logging: false }).then(function (canvas) {
58+
(0, _html2canvas2.default)(targetComponent, {
59+
logging: false,
60+
useCORS: true,
61+
scale: this.props.scale
62+
}).then(function (canvas) {
5963
var imgData = canvas.toDataURL('image/png');
6064
var pdf = new _jspdf2.default(options);
6165
pdf.addImage(imgData, 'JPEG', x, y);
@@ -79,6 +83,7 @@ ReactToPdf.defaultProps = {
7983
filename: 'download.pdf',
8084
x: 0,
8185
y: 0,
86+
scale: 1,
8287
onComplete: undefined,
8388
targetRef: undefined
8489
};

0 commit comments

Comments
 (0)