diff --git a/jspdf.plugin.from_html.js b/jspdf.plugin.from_html.js
index 05270fc93..7ab9120f5 100644
--- a/jspdf.plugin.from_html.js
+++ b/jspdf.plugin.from_html.js
@@ -756,14 +756,22 @@
};
Renderer.prototype.RenderTextFragment = function (text, style) {
var defaultFontSize,
- font;
+ font,
+ maxLineHeight;
+
+ maxLineHeight = 0;
+ defaultFontSize = 12;
+
if (this.pdf.internal.pageSize.height - this.pdf.margins_doc.bottom < this.y + this.pdf.internal.getFontSize()) {
this.pdf.internal.write("ET", "Q");
this.pdf.addPage();
this.y = this.pdf.margins_doc.top;
this.pdf.internal.write("q", "BT", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), "Td");
+ //move cursor by one line on new page
+ maxLineHeight = Math.max(maxLineHeight, style["line-height"], style["font-size"]);
+ this.pdf.internal.write(0, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td");
}
- defaultFontSize = 12;
+
font = this.pdf.internal.getFont(style["font-family"], style["font-style"]);
//set the word spacing for e.g. justify style
@@ -876,9 +884,9 @@
//split lines again due to possible coordinate changes
lines = this.splitFragmentsIntoLines(PurgeWhiteSpace(localFragments), localStyles);
//reposition the current cursor
- out("ET", "Q");
+ out("ET", "Q");
out("q", "BT", this.pdf.internal.getCoordinateString(this.x), this.pdf.internal.getVerticalCoordinateString(this.y), "Td");
- }
+ }
}
if (cb && typeof cb === "function") {