Skip to content

Commit cefb802

Browse files
committed
v2.5.26
1 parent 17011ec commit cefb802

File tree

6 files changed

+12
-5
lines changed

6 files changed

+12
-5
lines changed

browser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/browser-2.5.25.js renamed to docs/browser-2.5.26.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h1>HTML to PDFMake convertor</h1>
116116
<div id="pdf_ie" style="display:none;padding:3em">The PDF file is sent to you for download. Use a modern browser (like Chrome or Firefox) to display the PDF in this page.</div>
117117
</div>
118118
</div>
119-
<script src="browser-2.5.25.js"></script>
119+
<script src="browser-2.5.26.js"></script>
120120
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/pdfmake.min.js"></script>
121121
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/vfs_fonts.js"></script>
122122
<script>

example.pdf

0 Bytes
Binary file not shown.

index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -787,8 +787,11 @@ function htmlToPdfMake(htmlText, options) {
787787

788788
// we now need to convert to PT
789789
value.forEach(function(val, i) {
790-
value[i] = _this.convertToUnit(val);
790+
// PDFMake doesn't support "auto" as a value
791+
if (val === 'auto') value[i] = '';
792+
else value[i] = _this.convertToUnit(val);
791793
});
794+
792795
// ignore if we have a FALSE in the table
793796
if (value.indexOf(false) === -1) ret.push({key:key, value:value});
794797
break;
@@ -865,6 +868,7 @@ function htmlToPdfMake(htmlText, options) {
865868
} else {
866869
// ignore some properties
867870
if (ignoreProperties && (key.indexOf("margin-") === 0 || key === 'width' || key === 'height')) break;
871+
868872
// for IMG only (see issue #181)
869873
if (nodeName === "IMG" && (key === 'width' || key === 'height')) {
870874
ret.push({key:key, value: _this.convertToUnit(value)});
@@ -896,6 +900,9 @@ function htmlToPdfMake(htmlText, options) {
896900
break;
897901
}
898902
}
903+
// PDFMake doesn't support "auto" as a value for "margin" (at least)
904+
if (key.indexOf("margin") === 0 && value === 'auto') break;
905+
899906
ret.push({key:key, value:(parsedValue === false ? value : parsedValue)});
900907
}
901908
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-to-pdfmake",
3-
"version": "2.5.25",
3+
"version": "2.5.26",
44
"description": "Convert HTML code to PDFMake",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)