Skip to content

Commit 6f986b1

Browse files
dursUzlopak
authored andcommitted
fix addPage execption and correctly set mediaBox (#2193)
1 parent 55c4851 commit 6f986b1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/jspdf.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ var jsPDF = (function (global) {
825825
out('<</Type /Page');
826826
out('/Parent ' + page.rootDictionaryObjId + ' 0 R');
827827
out('/Resources ' + page.resourceDictionaryObjId + ' 0 R');
828-
out('/MediaBox [' + parseFloat(f2(page.mediaBox.bottomLeftX)) + ' ' + parseFloat(f2(page.mediaBox.bottomLeftY)) + ' ' + f2(pagesContext[currentPage].mediaBox.topRightX) + ' ' + f2(pagesContext[currentPage].mediaBox.topRightY) + ']');
828+
out('/MediaBox [' + parseFloat(f2(page.mediaBox.bottomLeftX)) + ' ' + parseFloat(f2(page.mediaBox.bottomLeftY)) + ' ' + f2(page.mediaBox.topRightX) + ' ' + f2(page.mediaBox.topRightY) + ']');
829829
if (page.cropBox !== null) {
830830
out('/CropBox [' + f2(page.cropBox.bottomLeftX) + ' ' + f2(page.cropBox.bottomLeftY) + ' ' + f2(page.cropBox.topRightX) + ' ' + f2(page.cropBox.topRightY) + ']');
831831
}
@@ -1214,9 +1214,9 @@ var jsPDF = (function (global) {
12141214
var orientation = typeof height === 'string' && height.toLowerCase();
12151215

12161216
if (typeof width === 'string') {
1217-
if (getPageFormat(width.toLowerCase())) {
1218-
width = getPageFormat(width.toLowerCase())[0];
1219-
height = getPageFormat(width.toLowerCase())[1];
1217+
if (tmp = getPageFormat(width.toLowerCase())) {
1218+
width = tmp[0];
1219+
height = tmp[1];
12201220
}
12211221
}
12221222
if (Array.isArray(width)) {

0 commit comments

Comments
 (0)