Permalink
Browse files

empty line between first lines on new page removed

  • Loading branch information...
1 parent 4e6bcb4 commit 9c70e270735a8a6317900838ca00ba3699ae4ed9 @woolfg woolfg committed Jun 5, 2014
Showing with 12 additions and 4 deletions.
  1. +12 −4 jspdf.plugin.from_html.js
View
@@ -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") {

0 comments on commit 9c70e27

Please sign in to comment.