Skip to content

Commit

Permalink
Merge pull request #1593 from arasabbasi/fix_for_637
Browse files Browse the repository at this point in the history
Fix for 637
  • Loading branch information
MrRio authored Jan 30, 2018
2 parents 2e898a8 + 0e8c6e7 commit efdbc92
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions jspdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -1309,10 +1309,10 @@ var jsPDF = (function(global) {
// through multiplication.
'scaleFactor': k,
'pageSize': {
get width() {
getWidth: function() {
return pageWidth
},
get height() {
getHeight: function() {
return pageHeight
}
},
Expand Down
2 changes: 1 addition & 1 deletion plugins/acroform.js
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@
throw new Error("Exception while creating AcroformDictionary");
}
scaleFactor = scope.internal.scaleFactor;
pageHeight = scope.internal.pageSize.height;
pageHeight = scope.internal.pageSize.getHeight();

// The Object Number of the AcroForm Dictionary
scope.internal.acroformPlugin.acroFormDictionaryRoot = new AcroFormDictionary();
Expand Down
2 changes: 1 addition & 1 deletion plugins/addhtml.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
callback = function () {};
}

var I = this.internal, K = I.scaleFactor, W = I.pageSize.width, H = I.pageSize.height;
var I = this.internal, K = I.scaleFactor, W = I.pageSize.getWidth(), H = I.pageSize.getHeight();

options = options || {};
options.onrendered = function(obj) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
this.internal.write("/Annots [");
var f2 = this.annotationPlugin.f2;
var k = this.internal.scaleFactor;
var pageHeight = this.internal.pageSize.height;
var pageHeight = this.internal.pageSize.getHeight();
var pageInfo = this.internal.getPageInfo(info.pageNumber);
for (var a = 0; a < pageAnnos.length; a++) {
var anno = pageAnnos[a];
Expand Down
4 changes: 2 additions & 2 deletions plugins/cell.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
} else {
//New line
var margins = this.margins || NO_MARGINS;
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) {
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.getHeight() - margins.bottom) {
this.cellAddPage();
pgAdded = true;
if (this.printHeaders && this.tableHeaderRow) {
Expand Down Expand Up @@ -222,7 +222,7 @@
fontSize = 12,
margins = NO_MARGINS;

margins.width = this.internal.pageSize.width;
margins.width = this.internal.pageSize.getWidth();

if (config) {
//override config defaults if the user has specified non-default behavior:
Expand Down
8 changes: 4 additions & 4 deletions plugins/context2d.js
Original file line number Diff line number Diff line change
Expand Up @@ -1366,7 +1366,7 @@
var includeMove = true;

var k = this.pdf.internal.scaleFactor;
var pageHeight = this.pdf.internal.pageSize.height;
var pageHeight = this.pdf.internal.pageSize.getHeight();
var f2 = this.pdf.internal.f2;

var a1r = a1 * (Math.PI / 180);
Expand Down Expand Up @@ -1442,7 +1442,7 @@
end = c2d._matrix_map_point_obj(matrix, end);

var k = this.pdf.internal.scaleFactor;
var pageHeight = this.pdf.internal.pageSize.height;
var pageHeight = this.pdf.internal.pageSize.getHeight();
var f2 = this.pdf.internal.f2;
this.pdf.internal.out([
f2((start.x) * k), f2((pageHeight - (start.y)) * k), 'm', f2((pt1.x) * k), f2((pageHeight - (pt1.y)) * k), f2((pt2.x) * k), f2((pageHeight - (pt2.y)) * k), f2((end.x) * k), f2((pageHeight - (end.y)) * k), 'c'
Expand All @@ -1462,7 +1462,7 @@

c2d.internal.move2 = function (c2d, x, y) {
var k = this.pdf.internal.scaleFactor;
var pageHeight = this.pdf.internal.pageSize.height;
var pageHeight = this.pdf.internal.pageSize.getHeight();
var f2 = this.pdf.internal.f2;

this.pdf.internal.out([
Expand All @@ -1473,7 +1473,7 @@

c2d.internal.line2 = function (c2d, dx, dy) {
var k = this.pdf.internal.scaleFactor;
var pageHeight = this.pdf.internal.pageSize.height;
var pageHeight = this.pdf.internal.pageSize.getHeight();
var f2 = this.pdf.internal.f2;

//var pt = {x: c2d._lastPoint.x + dx, y: c2d._lastPoint.y + dy};
Expand Down
8 changes: 4 additions & 4 deletions plugins/from_html.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@
headers[i] = {
name : cell.textContent.toLowerCase().replace(/\s+/g, ''),
prompt : cell.textContent.replace(/\r?\n/g, ''),
width : (cell.clientWidth / table_with) * renderer.pdf.internal.pageSize.width
width : (cell.clientWidth / table_with) * renderer.pdf.internal.pageSize.getWidth()
};
i++;
}
Expand Down Expand Up @@ -395,7 +395,7 @@
cached_image = images[renderer.pdf.sHashCode(url) || url];
}
if (cached_image) {
if ((renderer.pdf.internal.pageSize.height - renderer.pdf.margins_doc.bottom < renderer.y + cn.height) && (renderer.y > renderer.pdf.margins_doc.top)) {
if ((renderer.pdf.internal.pageSize.getHeight() - renderer.pdf.margins_doc.bottom < renderer.y + cn.height) && (renderer.y > renderer.pdf.margins_doc.top)) {
renderer.pdf.addPage();
renderer.y = renderer.pdf.margins_doc.top;
//check if we have to set back some values due to e.g. header rendering for new page
Expand Down Expand Up @@ -596,7 +596,7 @@
//set current y position to old margin
var oldPosition = renderer.y;
//render all child nodes of the header element
renderer.y = renderer.pdf.internal.pageSize.height - renderer.pdf.margins_doc.bottom;
renderer.y = renderer.pdf.internal.pageSize.getHeight() - renderer.pdf.margins_doc.bottom;
renderer.pdf.margins_doc.bottom -= footerHeight;

//check if we have to add page numbers
Expand Down Expand Up @@ -815,7 +815,7 @@
maxLineHeight = 0;
defaultFontSize = 12;

if (this.pdf.internal.pageSize.height - this.pdf.margins_doc.bottom < this.y + this.pdf.internal.getFontSize()) {
if (this.pdf.internal.pageSize.getHeight() - this.pdf.margins_doc.bottom < this.y + this.pdf.internal.getFontSize()) {
this.pdf.internal.write("ET", "Q");
this.pdf.addPage();
this.y = this.pdf.margins_doc.top;
Expand Down
4 changes: 2 additions & 2 deletions plugins/outline.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@
// Explicit Destination
//WARNING this assumes page ids are 3,5,7, etc.
var info = pdf.internal.getPageInfo(item.options.pageNumber)
this.line('/Dest ' + '[' + info.objId + ' 0 R /XYZ 0 ' + this.ctx.pdf.internal.pageSize.height*this.ctx.pdf.internal.scaleFactor + ' 0]');
this.line('/Dest ' + '[' + info.objId + ' 0 R /XYZ 0 ' + this.ctx.pdf.internal.pageSize.getHeight()*this.ctx.pdf.internal.scaleFactor + ' 0]');
// this line does not work on all clients (pageNumber instead of page ref)
//this.line('/Dest ' + '[' + (item.options.pageNumber - 1) + ' /XYZ 0 ' + this.ctx.pdf.internal.pageSize.height + ' 0]');
//this.line('/Dest ' + '[' + (item.options.pageNumber - 1) + ' /XYZ 0 ' + this.ctx.pdf.internal.pageSize.getHeight() + ' 0]');

// Named Destination
// this.line('/Dest (page_' + (item.options.pageNumber) + ')');
Expand Down

0 comments on commit efdbc92

Please sign in to comment.