Skip to content

Commit 5c1a393

Browse files
committed
Merge branch 'master' of https://github.com/MrRio/jsPDF
2 parents 7dd2bd8 + 5d80eaa commit 5c1a393

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

plugins/cell.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@
105105

106106
jsPDFAPI.cell = function (x, y, w, h, txt, ln, align) {
107107
var curCell = getLastCellPosition();
108+
var pgAdded = false;
108109

109110
// If this is not the first cell, we must change its position
110111
if (curCell.ln !== undefined) {
@@ -117,13 +118,14 @@
117118
var margins = this.margins || NO_MARGINS;
118119
if ((curCell.y + curCell.h + h + margin) >= this.internal.pageSize.height - margins.bottom) {
119120
this.cellAddPage();
121+
pgAdded = true;
120122
if (this.printHeaders && this.tableHeaderRow) {
121123
this.printHeaderRow(ln, true);
122124
}
123125
}
124126
//We ignore the passed y: the lines may have diferent heights
125127
y = (getLastCellPosition().y + getLastCellPosition().h);
126-
128+
if (pgAdded) y = margin + 10;
127129
}
128130
}
129131

@@ -233,6 +235,9 @@
233235
if(config.fontSize){
234236
fontSize = config.fontSize;
235237
}
238+
if (config.css['font-size']) {
239+
fontSize = config.css['font-size'] * 16;
240+
}
236241
if(config.margins){
237242
margins = config.margins;
238243
}
@@ -390,6 +395,7 @@
390395

391396
tableHeaderCell = this.tableHeaderRow[i];
392397
if (new_page) {
398+
this.margins.top = margin;
393399
tableHeaderCell[1] = this.margins && this.margins.top || 0;
394400
tempHeaderConf.push(tableHeaderCell);
395401
}

plugins/from_html.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,8 +451,9 @@
451451
renderer.y += 10;
452452
renderer.pdf.table(renderer.x, renderer.y, table2json.rows, table2json.headers, {
453453
autoSize : false,
454-
printHeaders : true,
455-
margins : renderer.pdf.margins_doc
454+
printHeaders: elementHandlers.printHeaders,
455+
margins: renderer.pdf.margins_doc,
456+
css: GetCSS(cn)
456457
});
457458
renderer.y = renderer.pdf.lastCellPos.y + renderer.pdf.lastCellPos.h + 20;
458459
} else if (cn.nodeName === "OL" || cn.nodeName === "UL") {
@@ -502,6 +503,7 @@
502503
}
503504
i++;
504505
}
506+
elementHandlers.outY = renderer.y;
505507

506508
if (isBlock) {
507509
return renderer.setBlockBoundary(cb);

0 commit comments

Comments
 (0)