Skip to content

Commit e931375

Browse files
committed
Fixed #257
1 parent 4952bd2 commit e931375

File tree

4 files changed

+36
-24
lines changed

4 files changed

+36
-24
lines changed

bower.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jspdf",
3-
"version": "1.0.131",
3+
"version": "1.0.133",
44
"homepage": "https://github.com/mrrio/jspdf",
55
"description": "PDF Document creation from JavaScript",
66
"main": "dist/jspdf.min.js",

dist/jspdf.debug.js

+17-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/** @preserve
22
* jsPDF - PDF Document creation from JavaScript
3-
* Version 1.0.131-git Built on 2014-05-11T20:51
4-
* CommitID 9ca4a6ded0
3+
* Version 1.0.133-git Built on 2014-05-13T00:23
4+
* CommitID 4952bd270a
55
*
66
* Copyright (c) 2010-2014 James Hall, https://github.com/MrRio/jsPDF
77
* 2010 Aaron Spike, https://github.com/acspike
@@ -1693,7 +1693,7 @@ var jsPDF = (function(global) {
16931693
* pdfdoc.mymethod() // <- !!!!!!
16941694
*/
16951695
jsPDF.API = {events:[]};
1696-
jsPDF.version = "1.0.131-debug 2014-05-11T20:51:diegocr";
1696+
jsPDF.version = "1.0.133-debug 2014-05-13T00:23:diegocr";
16971697

16981698
if (typeof define === 'function') {
16991699
define(function() {
@@ -2440,7 +2440,7 @@ var jsPDF = (function(global) {
24402440
return this;
24412441
};
24422442
})(jsPDF.API);
2443-
/** ====================================================================
2443+
/** ====================================================================
24442444
* jsPDF Cell plugin
24452445
* Copyright (c) 2013 Youssef Beddad, [email protected]
24462446
* 2013 Eduardo Menezes de Morais, [email protected]
@@ -2456,10 +2456,10 @@ var jsPDF = (function(global) {
24562456
* distribute, sublicense, and/or sell copies of the Software, and to
24572457
* permit persons to whom the Software is furnished to do so, subject to
24582458
* the following conditions:
2459-
*
2459+
*
24602460
* The above copyright notice and this permission notice shall be
24612461
* included in all copies or substantial portions of the Software.
2462-
*
2462+
*
24632463
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
24642464
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24652465
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -2488,7 +2488,8 @@ var jsPDF = (function(global) {
24882488
},
24892489
getLastCellPosition = function () {
24902490
return lastCellPos;
2491-
};
2491+
},
2492+
NO_MARGINS = {left:0, top:0, bottom: 0};
24922493

24932494
jsPDFAPI.setHeaderFunction = function (func) {
24942495
headerFunction = func;
@@ -2520,9 +2521,11 @@ var jsPDF = (function(global) {
25202521
};
25212522

25222523
jsPDFAPI.cellAddPage = function () {
2524+
var margins = this.margins || NO_MARGINS;
2525+
25232526
this.addPage();
25242527

2525-
setLastCellPosition(this.margins.left, this.margins.top, undefined, undefined);
2528+
setLastCellPosition(margins.left, margins.top, undefined, undefined);
25262529
//setLastCellPosition(undefined, undefined, undefined, undefined, undefined);
25272530
pages += 1;
25282531
};
@@ -2543,7 +2546,8 @@ var jsPDF = (function(global) {
25432546
y = curCell.y;
25442547
} else {
25452548
//New line
2546-
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - this.margins.bottom) {
2549+
var margins = this.margins || NO_MARGINS;
2550+
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) {
25472551
this.cellAddPage();
25482552
if (this.printHeaders && this.tableHeaderRow) {
25492553
this.printHeaderRow(ln, true);
@@ -2645,7 +2649,9 @@ var jsPDF = (function(global) {
26452649
autoSize = false,
26462650
printHeaders = true,
26472651
fontSize = 12,
2648-
margins = {left:0, top:0, bottom: 0, width: this.internal.pageSize.width};
2652+
margins = NO_MARGINS;
2653+
2654+
margins.width = this.internal.pageSize.width;
26492655

26502656
if (config) {
26512657
//override config defaults if the user has specified non-default behavior:
@@ -2812,7 +2818,7 @@ var jsPDF = (function(global) {
28122818

28132819
tableHeaderCell = this.tableHeaderRow[i];
28142820
if (new_page) {
2815-
tableHeaderCell[1] = this.margins.top;
2821+
tableHeaderCell[1] = this.margins && this.margins.top || 0;
28162822
tempHeaderConf.push(tableHeaderCell);
28172823
}
28182824
tmpArray = [].concat(tableHeaderCell);

dist/jspdf.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jspdf.plugin.cell.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/** ====================================================================
1+
/** ====================================================================
22
* jsPDF Cell plugin
33
* Copyright (c) 2013 Youssef Beddad, [email protected]
44
* 2013 Eduardo Menezes de Morais, [email protected]
@@ -14,10 +14,10 @@
1414
* distribute, sublicense, and/or sell copies of the Software, and to
1515
* permit persons to whom the Software is furnished to do so, subject to
1616
* the following conditions:
17-
*
17+
*
1818
* The above copyright notice and this permission notice shall be
1919
* included in all copies or substantial portions of the Software.
20-
*
20+
*
2121
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
2222
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
2323
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
@@ -46,7 +46,8 @@
4646
},
4747
getLastCellPosition = function () {
4848
return lastCellPos;
49-
};
49+
},
50+
NO_MARGINS = {left:0, top:0, bottom: 0};
5051

5152
jsPDFAPI.setHeaderFunction = function (func) {
5253
headerFunction = func;
@@ -78,9 +79,11 @@
7879
};
7980

8081
jsPDFAPI.cellAddPage = function () {
82+
var margins = this.margins || NO_MARGINS;
83+
8184
this.addPage();
8285

83-
setLastCellPosition(this.margins.left, this.margins.top, undefined, undefined);
86+
setLastCellPosition(margins.left, margins.top, undefined, undefined);
8487
//setLastCellPosition(undefined, undefined, undefined, undefined, undefined);
8588
pages += 1;
8689
};
@@ -101,7 +104,8 @@
101104
y = curCell.y;
102105
} else {
103106
//New line
104-
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - this.margins.bottom) {
107+
var margins = this.margins || NO_MARGINS;
108+
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) {
105109
this.cellAddPage();
106110
if (this.printHeaders && this.tableHeaderRow) {
107111
this.printHeaderRow(ln, true);
@@ -203,7 +207,9 @@
203207
autoSize = false,
204208
printHeaders = true,
205209
fontSize = 12,
206-
margins = {left:0, top:0, bottom: 0, width: this.internal.pageSize.width};
210+
margins = NO_MARGINS;
211+
212+
margins.width = this.internal.pageSize.width;
207213

208214
if (config) {
209215
//override config defaults if the user has specified non-default behavior:
@@ -370,7 +376,7 @@
370376

371377
tableHeaderCell = this.tableHeaderRow[i];
372378
if (new_page) {
373-
tableHeaderCell[1] = this.margins.top;
379+
tableHeaderCell[1] = this.margins && this.margins.top || 0;
374380
tempHeaderConf.push(tableHeaderCell);
375381
}
376382
tmpArray = [].concat(tableHeaderCell);

0 commit comments

Comments
 (0)