11/** @preserve
22 * 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
55 *
66 * Copyright (c) 2010-2014 James Hall <james@parall.ax>, https://github.com/MrRio/jsPDF
77 * 2010 Aaron Spike, https://github.com/acspike
@@ -1263,7 +1263,7 @@ var jsPDF = (function (global) {
12631263
12641264 if (typeof text === 'string') {
12651265 text = ESC(text);
1266- } else if (text instanceof Array) {
1266+ } else if (Object.prototype.toString.call( text) === '[object Array]' ) {
12671267 // we don't want to destroy original text array, so cloning it
12681268 var sa = text.concat(), da = [], len = sa.length;
12691269 // we do array.join('text that must not be PDFescaped")
@@ -2087,7 +2087,7 @@ var jsPDF = (function (global) {
20872087 * pdfdoc.mymethod() // <- !!!!!!
20882088 */
20892089 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";
20912091
20922092 if (typeof define === 'function' && define.amd) {
20932093 define('jsPDF', function () {
@@ -5055,6 +5055,7 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
50555055
50565056 jsPDFAPI.cell = function (x, y, w, h, txt, ln, align) {
50575057 var curCell = getLastCellPosition();
5058+ var pgAdded = false;
50585059
50595060 // If this is not the first cell, we must change its position
50605061 if (curCell.ln !== undefined) {
@@ -5067,13 +5068,14 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
50675068 var margins = this.margins || NO_MARGINS;
50685069 if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) {
50695070 this.cellAddPage();
5071+ pgAdded = true;
50705072 if (this.printHeaders && this.tableHeaderRow) {
50715073 this.printHeaderRow(ln, true);
50725074 }
50735075 }
50745076 //We ignore the passed y: the lines may have diferent heights
50755077 y = (getLastCellPosition().y + getLastCellPosition().h);
5076-
5078+ if (pgAdded) y = margin + 10;
50775079 }
50785080 }
50795081
@@ -5183,6 +5185,9 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
51835185 if(config.fontSize){
51845186 fontSize = config.fontSize;
51855187 }
5188+ if (config.css['font-size']) {
5189+ fontSize = config.css['font-size'] * 16;
5190+ }
51865191 if(config.margins){
51875192 margins = config.margins;
51885193 }
@@ -5340,6 +5345,7 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
53405345
53415346 tableHeaderCell = this.tableHeaderRow[i];
53425347 if (new_page) {
5348+ this.margins.top = margin;
53435349 tableHeaderCell[1] = this.margins && this.margins.top || 0;
53445350 tempHeaderConf.push(tableHeaderCell);
53455351 }
@@ -6583,8 +6589,9 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
65836589 renderer.y += 10;
65846590 renderer.pdf.table(renderer.x, renderer.y, table2json.rows, table2json.headers, {
65856591 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)
65886595 });
65896596 renderer.y = renderer.pdf.lastCellPos.y + renderer.pdf.lastCellPos.h + 20;
65906597 } else if (cn.nodeName === "OL" || cn.nodeName === "UL") {
@@ -6634,6 +6641,7 @@ AcroForm.internal.setBitPosition = function (variable, position, value) {
66346641 }
66356642 i++;
66366643 }
6644+ elementHandlers.outY = renderer.y;
66376645
66386646 if (isBlock) {
66396647 return renderer.setBlockBoundary(cb);
@@ -8711,59 +8719,36 @@ somewhere around "pdfEscape" call.
87118719*/
87128720
87138721API.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
87238725 , unicode_section
87248726 , encoding = 'Unicode'
8725- , encodingBlock
8726-
8727- for (fontID in fontManagementObjects.fonts){
8728- if (fontManagementObjects.fonts.hasOwnProperty(fontID)) {
8729- font = fontManagementObjects.fonts[fontID]
8727+ , encodingBlock;
87308728
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+ }
87368736
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+ }
87448740
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+ }
87598748
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];
87678752 }
87688753 }
87698754 }
0 commit comments