Skip to content

Commit 93aab85

Browse files
committed
Remove renderMaxWidthOverflow flag
1 parent 16499ee commit 93aab85

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

src/jspdf.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3327,7 +3327,7 @@ function jsPDF(options) {
33273327
*/
33283328
options = options || {};
33293329
var scope = options.scope || this;
3330-
var payload, da, angle, align, charSpace, maxWidth, renderMaxWidthOverflow, flags;
3330+
var payload, da, angle, align, charSpace, maxWidth, flags;
33313331

33323332
// Pre-August-2012 the order of arguments was function(x, y, text, flags)
33333333
// in effort to make all calls have similar signature like
@@ -3526,7 +3526,6 @@ function jsPDF(options) {
35263526

35273527
//multiline
35283528
maxWidth = options.maxWidth || 0;
3529-
renderMaxWidthOverflow = options.renderMaxWidthOverflow !== undefined ? options.renderMaxWidthOverflow : true;
35303529

35313530
if (maxWidth > 0) {
35323531
if (typeof text === "string") {
@@ -3538,10 +3537,6 @@ function jsPDF(options) {
35383537
}
35393538
}
35403539

3541-
if (!renderMaxWidthOverflow) {
3542-
text = [text[0]];
3543-
}
3544-
35453540
//creating Payload-Object to make text byRef
35463541
payload = {
35473542
text: text,

src/modules/context2d.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,11 +2073,11 @@ import { console } from "../libs/console.js";
20732073

20742074
if (tmpRect.y <= pageHeightMinusMargin) {
20752075
if (tmpRect.y - tmpRect.h >= 0 && tmpRect.x <= pageWidthMinusMargin) {
2076-
this.pdf.text(options.text, tmpRect.x, tmpRect.y, {
2076+
var croppedText = this.pdf.splitTextToSize(options.text, options.maxWidth || pageWidthMinusMargin - tmpRect.x)[0];
2077+
this.pdf.text(croppedText, tmpRect.x, tmpRect.y, {
20772078
angle: options.angle,
20782079
align: textAlign,
20792080
renderingMode: options.renderingMode,
2080-
maxWidth: options.maxWidth || pageWidthMinusMargin - tmpRect.x,
20812081
renderMaxWidthOverflow: false
20822082
});
20832083
}

0 commit comments

Comments
 (0)