1
1
/** @preserve
2
2
* jsPDF - PDF Document creation from JavaScript
3
- * Version 1.2.60-git Built on 2016-02-29T14 :46
4
- * CommitID 50d821b902
3
+ * Version 1.2.60-git Built on 2016-02-29T18 :46
4
+ * CommitID 89d166f561
5
5
*
6
6
* Copyright (c) 2010-2014 James Hall <
[email protected] >, https://github.com/MrRio/jsPDF
7
7
* 2010 Aaron Spike, https://github.com/acspike
@@ -1263,7 +1263,7 @@ var jsPDF = (function (global) {
1263
1263
1264
1264
if (typeof text === 'string') {
1265
1265
text = ESC(text);
1266
- } else if (text instanceof Array) {
1266
+ } else if (Object.prototype.toString.call( text) === '[object Array]' ) {
1267
1267
// we don't want to destroy original text array, so cloning it
1268
1268
var sa = text.concat(), da = [], len = sa.length;
1269
1269
// we do array.join('text that must not be PDFescaped")
@@ -2087,7 +2087,7 @@ var jsPDF = (function (global) {
2087
2087
* pdfdoc.mymethod() // <- !!!!!!
2088
2088
*/
2089
2089
jsPDF.API = {events: []};
2090
- jsPDF.version = "1.2.60-debug 2016-02-29T14 :46:jameshall";
2090
+ jsPDF.version = "1.2.60-debug 2016-02-29T18 :46:jameshall";
2091
2091
2092
2092
if (typeof define === 'function' && define.amd) {
2093
2093
define('jsPDF', function () {
@@ -5055,6 +5055,7 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
5055
5055
5056
5056
jsPDFAPI.cell = function (x, y, w, h, txt, ln, align) {
5057
5057
var curCell = getLastCellPosition();
5058
+ var pgAdded = false;
5058
5059
5059
5060
// If this is not the first cell, we must change its position
5060
5061
if (curCell.ln !== undefined) {
@@ -5067,13 +5068,14 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
5067
5068
var margins = this.margins || NO_MARGINS;
5068
5069
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) {
5069
5070
this.cellAddPage();
5071
+ pgAdded = true;
5070
5072
if (this.printHeaders && this.tableHeaderRow) {
5071
5073
this.printHeaderRow(ln, true);
5072
5074
}
5073
5075
}
5074
5076
//We ignore the passed y: the lines may have diferent heights
5075
5077
y = (getLastCellPosition().y + getLastCellPosition().h);
5076
-
5078
+ if (pgAdded) y = margin + 10;
5077
5079
}
5078
5080
}
5079
5081
@@ -5183,6 +5185,9 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
5183
5185
if(config.fontSize){
5184
5186
fontSize = config.fontSize;
5185
5187
}
5188
+ if (config.css['font-size']) {
5189
+ fontSize = config.css['font-size'] * 16;
5190
+ }
5186
5191
if(config.margins){
5187
5192
margins = config.margins;
5188
5193
}
@@ -5340,6 +5345,7 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
5340
5345
5341
5346
tableHeaderCell = this.tableHeaderRow[i];
5342
5347
if (new_page) {
5348
+ this.margins.top = margin;
5343
5349
tableHeaderCell[1] = this.margins && this.margins.top || 0;
5344
5350
tempHeaderConf.push(tableHeaderCell);
5345
5351
}
@@ -6583,8 +6589,9 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
6583
6589
renderer.y += 10;
6584
6590
renderer.pdf.table(renderer.x, renderer.y, table2json.rows, table2json.headers, {
6585
6591
autoSize : false,
6586
- printHeaders : true,
6587
- margins : renderer.pdf.margins_doc
6592
+ printHeaders: elementHandlers.printHeaders,
6593
+ margins: renderer.pdf.margins_doc,
6594
+ css: GetCSS(cn)
6588
6595
});
6589
6596
renderer.y = renderer.pdf.lastCellPos.y + renderer.pdf.lastCellPos.h + 20;
6590
6597
} else if (cn.nodeName === "OL" || cn.nodeName === "UL") {
@@ -6634,6 +6641,7 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
6634
6641
}
6635
6642
i++;
6636
6643
}
6644
+ elementHandlers.outY = renderer.y;
6637
6645
6638
6646
if (isBlock) {
6639
6647
return renderer.setBlockBoundary(cb);
@@ -8711,59 +8719,36 @@ somewhere around "pdfEscape" call.
8711
8719
*/
8712
8720
8713
8721
API.events.push([
8714
- 'addFonts'
8715
- ,function(fontManagementObjects) {
8716
- // fontManagementObjects is {
8717
- // 'fonts':font_ID-keyed hash of font objects
8718
- // , 'dictionary': lookup object, linking ["FontFamily"]['Style'] to font ID
8719
- //}
8720
- var font
8721
- , fontID
8722
- , metrics
8722
+ 'addFont'
8723
+ ,function(font) {
8724
+ var metrics
8723
8725
, unicode_section
8724
8726
, encoding = 'Unicode'
8725
- , encodingBlock
8726
-
8727
- for (fontID in fontManagementObjects.fonts){
8728
- if (fontManagementObjects.fonts.hasOwnProperty(fontID)) {
8729
- font = fontManagementObjects.fonts[fontID]
8727
+ , encodingBlock;
8730
8728
8731
- // // we only ship 'Unicode' mappings and metrics. No need for loop.
8732
- // // still, leaving this for the future.
8733
-
8734
- // for (encoding in fontMetrics){
8735
- // if (fontMetrics.hasOwnProperty(encoding)) {
8729
+ metrics = fontMetrics[encoding][font.PostScriptName];
8730
+ if (metrics) {
8731
+ if (font.metadata[encoding]) {
8732
+ unicode_section = font.metadata[encoding];
8733
+ } else {
8734
+ unicode_section = font.metadata[encoding] = {};
8735
+ }
8736
8736
8737
- metrics = fontMetrics[encoding][font.PostScriptName]
8738
- if (metrics) {
8739
- if (font.metadata[encoding]) {
8740
- unicode_section = font.metadata[encoding]
8741
- } else {
8742
- unicode_section = font.metadata[encoding] = {}
8743
- }
8737
+ unicode_section.widths = metrics.widths;
8738
+ unicode_section.kerning = metrics.kerning;
8739
+ }
8744
8740
8745
- unicode_section.widths = metrics.widths
8746
- unicode_section.kerning = metrics.kerning
8747
- }
8748
- // }
8749
- // }
8750
- // for (encoding in encodings){
8751
- // if (encodings.hasOwnProperty(encoding)) {
8752
- encodingBlock = encodings[encoding][font.PostScriptName]
8753
- if (encodingBlock) {
8754
- if (font.metadata[encoding]) {
8755
- unicode_section = font.metadata[encoding]
8756
- } else {
8757
- unicode_section = font.metadata[encoding] = {}
8758
- }
8741
+ encodingBlock = encodings[encoding][font.PostScriptName];
8742
+ if (encodingBlock) {
8743
+ if (font.metadata[encoding]) {
8744
+ unicode_section = font.metadata[encoding];
8745
+ } else {
8746
+ unicode_section = font.metadata[encoding] = {};
8747
+ }
8759
8748
8760
- unicode_section.encoding = encodingBlock
8761
- if (encodingBlock.codePages && encodingBlock.codePages.length) {
8762
- font.encoding = encodingBlock.codePages[0]
8763
- }
8764
- }
8765
- // }
8766
- // }
8749
+ unicode_section.encoding = encodingBlock;
8750
+ if (encodingBlock.codePages && encodingBlock.codePages.length) {
8751
+ font.encoding = encodingBlock.codePages[0];
8767
8752
}
8768
8753
}
8769
8754
}
0 commit comments