|
221 | 221 | //float and clearing of floats
|
222 | 222 | css["float"] = FloatMap[computedCSSElement("cssFloat")] || "none";
|
223 | 223 | css["clear"] = ClearMap[computedCSSElement("clear")] || "none";
|
224 |
| - |
| 224 | + |
225 | 225 | css["color"] = computedCSSElement("color");
|
226 | 226 |
|
227 | 227 | return css;
|
|
486 | 486 | value = listCount++ + '. ' + value;
|
487 | 487 | } else {
|
488 | 488 | var fontSize = fragmentCSS["font-size"];
|
489 |
| - offsetX = (3 - fontSize * 0.75) * renderer.pdf.internal.scaleFactor; |
490 |
| - offsetY = fontSize * 0.75 * renderer.pdf.internal.scaleFactor; |
491 |
| - radius = fontSize * 1.74 / renderer.pdf.internal.scaleFactor; |
| 489 | + var offsetX = (3 - fontSize * 0.75) * renderer.pdf.internal.scaleFactor; |
| 490 | + var offsetY = fontSize * 0.75 * renderer.pdf.internal.scaleFactor; |
| 491 | + var radius = fontSize * 1.74 / renderer.pdf.internal.scaleFactor; |
492 | 492 | cb = function (x, y) {
|
493 | 493 | this.pdf.circle(x + offsetX, y + offsetY, radius, 'FD');
|
494 | 494 | };
|
495 | 495 | }
|
496 | 496 | }
|
497 | 497 | // Only add the text if the text node is in the body element
|
498 | 498 | if (cn.ownerDocument.body.contains(cn)){
|
499 |
| - renderer.addText(value, fragmentCSS); |
| 499 | + renderer.addText(value, fragmentCSS); |
500 | 500 | }
|
501 | 501 | } else if (typeof cn === "string") {
|
502 | 502 | renderer.addText(cn, fragmentCSS);
|
|
809 | 809 | // text color
|
810 | 810 | var pdfTextColor = this.getPdfColor(style["color"]);
|
811 | 811 | if (pdfTextColor !== this.lastTextColor)
|
812 |
| - { |
813 |
| - this.pdf.internal.write(pdfTextColor); |
| 812 | + { |
| 813 | + this.pdf.internal.write(pdfTextColor); |
814 | 814 | this.lastTextColor = pdfTextColor;
|
815 | 815 | }
|
816 |
| - |
| 816 | + |
817 | 817 | //set the word spacing for e.g. justify style
|
818 | 818 | if (style['word-spacing'] !== undefined && style['word-spacing'] > 0) {
|
819 | 819 | this.pdf.internal.write(style['word-spacing'].toFixed(2), "Tw");
|
820 | 820 | }
|
821 | 821 |
|
822 | 822 | this.pdf.internal.write("/" + font.id, (defaultFontSize * style["font-size"]).toFixed(2), "Tf", "(" + this.pdf.internal.pdfEscape(text) + ") Tj");
|
823 | 823 |
|
824 |
| - |
| 824 | + |
825 | 825 | //set the word spacing back to neutral => 0
|
826 | 826 | if (style['word-spacing'] !== undefined) {
|
827 | 827 | this.pdf.internal.write(0, "Tw");
|
828 | 828 | }
|
829 | 829 | };
|
830 |
| - |
| 830 | + |
831 | 831 | // Accepts #FFFFFF, rgb(int,int,int), or CSS Color Name
|
832 | 832 | Renderer.prototype.getPdfColor = function(style) {
|
833 | 833 | var textColor;
|
834 | 834 | var r,g,b;
|
835 |
| - |
| 835 | + |
836 | 836 | var rx = /rgb\s*\(\s*(\d+),\s*(\d+),\s*(\d+\s*)\)/;
|
837 | 837 | var m = rx.exec(style);
|
838 | 838 | if (m != null){
|
|
854 | 854 | b = style.substring(5, 7);
|
855 | 855 | b = parseInt(b, 16);
|
856 | 856 | }
|
857 |
| - |
| 857 | + |
858 | 858 | if ((typeof r === 'string') && /^#[0-9A-Fa-f]{6}$/.test(r)) {
|
859 | 859 | var hex = parseInt(r.substr(1), 16);
|
860 | 860 | r = (hex >> 16) & 255;
|
|
870 | 870 | }
|
871 | 871 | return textColor;
|
872 | 872 | };
|
873 |
| - |
| 873 | + |
874 | 874 | Renderer.prototype.f3 = function(number) {
|
875 | 875 | return number.toFixed(3); // Ie, %.3f
|
876 | 876 | },
|
877 |
| - |
878 |
| - |
| 877 | + |
| 878 | + |
879 | 879 | Renderer.prototype.renderParagraph = function (cb) {
|
880 | 880 | var blockstyle,
|
881 | 881 | defaultFontSize,
|
|
920 | 920 | this.y = 0;
|
921 | 921 | paragraphspacing_before = ((blockstyle["margin-top"] || 0) + (blockstyle["padding-top"] || 0)) * fontToUnitRatio;
|
922 | 922 | }
|
923 |
| - |
| 923 | + |
924 | 924 | out = this.pdf.internal.write;
|
925 | 925 | i = void 0;
|
926 | 926 | l = void 0;
|
|
0 commit comments