|
87 | 87 | trailingSpace = true;
|
88 | 88 | i = 0;
|
89 | 89 | while (i !== l) {
|
90 |
| - fragment = array[i].replace(/\s+/g, " "); |
91 |
| - if (trailingSpace) { |
92 |
| - fragment = fragment.trimLeft(); |
93 |
| - } |
94 |
| - if (fragment) { |
95 |
| - trailingSpace = r.test(fragment); |
| 90 | + // Leave the line breaks intact |
| 91 | + if (array[i] != "\u2028") { |
| 92 | + fragment = array[i].replace(/\s+/g, " "); |
| 93 | + if (trailingSpace) { |
| 94 | + fragment = fragment.trimLeft(); |
| 95 | + } |
| 96 | + if (fragment) { |
| 97 | + trailingSpace = r.test(fragment); |
| 98 | + } |
| 99 | + array[i] = fragment; |
96 | 100 | }
|
97 |
| - array[i] = fragment; |
98 | 101 | i++;
|
99 | 102 | }
|
100 | 103 | return array;
|
|
463 | 466 | renderer.x = temp;
|
464 | 467 | } else if (cn.nodeName === "BR") {
|
465 | 468 | renderer.y += fragmentCSS["font-size"] * renderer.pdf.internal.scaleFactor;
|
| 469 | + renderer.addText("\u2028", clone(fragmentCSS)); |
466 | 470 | } else {
|
467 | 471 | if (!elementHandledElsewhere(cn, renderer, elementHandlers)) {
|
468 | 472 | DrillForContent(cn, renderer, elementHandlers);
|
|
723 | 727 | textIndent : currentLineLength
|
724 | 728 | };
|
725 | 729 | fragmentLength = this.pdf.getStringUnitWidth(fragment, fragmentSpecificMetrics) * fragmentSpecificMetrics.fontSize / k;
|
726 |
| - if (currentLineLength + fragmentLength > maxLineLength) { |
| 730 | + if (fragment == "\u2028") { |
| 731 | + line = []; |
| 732 | + lines.push(line); |
| 733 | + } else if (currentLineLength + fragmentLength > maxLineLength) { |
727 | 734 | fragmentChopped = this.pdf.splitTextToSize(fragment, maxLineLength, fragmentSpecificMetrics);
|
728 | 735 | line.push([fragmentChopped.shift(), style]);
|
729 | 736 | while (fragmentChopped.length) {
|
|
0 commit comments