|
5 | 5 | * 2014 Diego Casorran, https://github.com/diegocr
|
6 | 6 | * 2014 Daniel Husar, https://github.com/danielhusar
|
7 | 7 | * 2014 Wolfgang Gassler, https://github.com/woolfg
|
| 8 | + * 2014 Steven Spungin, https://github.com/flamenco |
8 | 9 | *
|
9 | 10 | * Permission is hereby granted, free of charge, to any person obtaining
|
10 | 11 | * a copy of this software and associated documentation files (the
|
|
811 | 812 | out,
|
812 | 813 | paragraphspacing_after,
|
813 | 814 | paragraphspacing_before,
|
814 |
| - priorblockstype, |
| 815 | + priorblockstyle, |
815 | 816 | styles,
|
816 | 817 | fontSize;
|
817 | 818 | fragments = PurgeWhiteSpace(this.paragraph.text);
|
818 | 819 | styles = this.paragraph.style;
|
819 | 820 | blockstyle = this.paragraph.blockstyle;
|
820 |
| - priorblockstype = this.paragraph.blockstyle || {}; |
| 821 | + priorblockstyle = this.paragraph.priorblockstyle || {}; |
821 | 822 | this.paragraph = {
|
822 | 823 | text : [],
|
823 | 824 | style : [],
|
|
832 | 833 | maxLineHeight = void 0;
|
833 | 834 | defaultFontSize = 12;
|
834 | 835 | fontToUnitRatio = defaultFontSize / this.pdf.internal.scaleFactor;
|
835 |
| - paragraphspacing_before = (Math.max((blockstyle["margin-top"] || 0) - (priorblockstype["margin-bottom"] || 0), 0) + (blockstyle["padding-top"] || 0)) * fontToUnitRatio; |
| 836 | + this.priorMarginBottom = this.priorMarginBottom || 0; |
| 837 | + paragraphspacing_before = (Math.max((blockstyle["margin-top"] || 0) - this.priorMarginBottom, 0) + (blockstyle["padding-top"] || 0)) * fontToUnitRatio; |
836 | 838 | paragraphspacing_after = ((blockstyle["margin-bottom"] || 0) + (blockstyle["padding-bottom"] || 0)) * fontToUnitRatio;
|
| 839 | + this.priorMarginBottom = blockstyle["margin-bottom"] || 0; |
| 840 | + |
837 | 841 | out = this.pdf.internal.write;
|
838 | 842 | i = void 0;
|
839 | 843 | l = void 0;
|
|
863 | 867 | indentMove = wantedIndent - currentIndent;
|
864 | 868 | currentIndent = wantedIndent;
|
865 | 869 | }
|
| 870 | + var indentMore = (Math.max(blockstyle["margin-left"] || 0, 0)) * fontToUnitRatio; |
866 | 871 | //move the cursor
|
867 |
| - out(indentMove, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td"); |
| 872 | + out(indentMove + indentMore, (-1 * defaultFontSize * maxLineHeight).toFixed(2), "Td"); |
868 | 873 | i = 0;
|
869 | 874 | l = line.length;
|
870 | 875 | while (i !== l) {
|
|
0 commit comments