diff --git a/plugins/cell.js b/plugins/cell.js index 67c3c5691..b247c655e 100644 --- a/plugins/cell.js +++ b/plugins/cell.js @@ -105,6 +105,7 @@ jsPDFAPI.cell = function (x, y, w, h, txt, ln, align) { var curCell = getLastCellPosition(); + var pgAdded = false; // If this is not the first cell, we must change its position if (curCell.ln !== undefined) { @@ -117,13 +118,14 @@ var margins = this.margins || NO_MARGINS; if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) { this.cellAddPage(); + pgAdded = true; if (this.printHeaders && this.tableHeaderRow) { this.printHeaderRow(ln, true); } } //We ignore the passed y: the lines may have diferent heights y = (getLastCellPosition().y + getLastCellPosition().h); - + if (pgAdded) y = margin + 10; } } @@ -233,6 +235,9 @@ if(config.fontSize){ fontSize = config.fontSize; } + if (config.css['font-size']) { + fontSize = config.css['font-size'] * 16; + } if(config.margins){ margins = config.margins; } @@ -390,6 +395,7 @@ tableHeaderCell = this.tableHeaderRow[i]; if (new_page) { + this.margins.top = margin; tableHeaderCell[1] = this.margins && this.margins.top || 0; tempHeaderConf.push(tableHeaderCell); } diff --git a/plugins/from_html.js b/plugins/from_html.js index 8403d9d4a..ec9b447eb 100644 --- a/plugins/from_html.js +++ b/plugins/from_html.js @@ -451,8 +451,9 @@ renderer.y += 10; renderer.pdf.table(renderer.x, renderer.y, table2json.rows, table2json.headers, { autoSize : false, - printHeaders : true, - margins : renderer.pdf.margins_doc + printHeaders: elementHandlers.printHeaders, + margins: renderer.pdf.margins_doc, + css: GetCSS(cn) }); renderer.y = renderer.pdf.lastCellPos.y + renderer.pdf.lastCellPos.h + 20; } else if (cn.nodeName === "OL" || cn.nodeName === "UL") { @@ -502,6 +503,7 @@ } i++; } + elementHandlers.outY = renderer.y; if (isBlock) { return renderer.setBlockBoundary(cb);