Skip to content

Commit

Permalink
v2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Aymkdn committed Oct 29, 2023
1 parent 03ace6a commit a53b424
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion browser.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion docs/browser-2.5.0.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/browser-2.5.1.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ <h1>HTML to PDFMake convertor</h1>
<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>
</div>
</div>
<script src="browser-2.5.0.js"></script>
<script src="browser-2.5.1.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/pdfmake.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/pdfmake@latest/build/vfs_fonts.js"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion example.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ var pdfDocGenerator = pdfMake.createPdf(docDefinition, {
vLineColor: function (colIndex, node, rowIndex) {
if (rowIndex === 0) return 'red';
return rowIndex > 0 && (colIndex === 0 || colIndex === node.table.body[0].length) ? 'blue' : 'black';
}
}
}
});
pdfDocGenerator.getBuffer(function(buffer) {
Expand Down
Binary file modified example.pdf
Binary file not shown.
15 changes: 8 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function htmlToPdfMake(htmlText, options) {
this.imagesByReference = (options && typeof options.imagesByReference === "boolean" ? options.imagesByReference : false);
this.removeExtraBlanks = (options && typeof options.removeExtraBlanks === "boolean" ? options.removeExtraBlanks : false);
this.showHidden = (options && typeof options.showHidden === "boolean" ? options.showHidden : false);
this.removeTagClasses = (options && typeof options.removeTagClasses === "boolean" ? options.removeTagClasses : false);
this.removeTagClasses = (options && typeof options.removeTagClasses === "boolean" ? options.removeTagClasses : false);
this.ignoreStyles = (options && Array.isArray(options.ignoreStyles) ? options.ignoreStyles : []);

// A random string to be used in the image references
Expand Down Expand Up @@ -258,10 +258,11 @@ function htmlToPdfMake(htmlText, options) {
// do we have a rowSpan?
if (cell.rowSpan>1) {
var len = cell.rowSpan;
var colspan = (cell.colSpan ? cell.colSpan : 1);
var cs, colspan = (cell.colSpan ? cell.colSpan : 1);
for (var i=1; i <= len-1; i++) {
cs = colspan;
if (ret.table.body[rowIndex+i]) {
while (colspan--) ret.table.body[rowIndex+i].splice(cellIndex, 0, {text:''});
while (cs--) ret.table.body[rowIndex+i].splice(cellIndex, 0, {text:''});
} else {
// if we have an empty <tr></tr>
cell.rowSpan--;
Expand Down Expand Up @@ -437,7 +438,7 @@ function htmlToPdfMake(htmlText, options) {
case 'I': ret.type = 'upper-roman'; break;
case 'i': ret.type = 'lower-roman'; break;
}

// check if we have `list-style-type` or `list-style`
if (ret.listStyle || ret.listStyleType) ret.type = ret.listStyle || ret.listStyleType;
break;
Expand Down Expand Up @@ -617,7 +618,7 @@ function htmlToPdfMake(htmlText, options) {
if (cssClass.length>0) params.ret.style = cssClass;
return params.ret;
}

/**
* Border Value Rearrange a CSS expression (e.g. 'border:solid 10px red' to 'border:10px solid red')
*
Expand All @@ -644,7 +645,7 @@ function htmlToPdfMake(htmlText, options) {
return styleStr;
}
}

/**
* Transform a CSS expression (e.g. 'margin:10px') in the PDFMake version
*
Expand Down Expand Up @@ -731,7 +732,7 @@ function htmlToPdfMake(htmlText, options) {
case "font-style": {
if (value==="italic") ret.push({key:"italics", value:true});
break;
}
}
case "font-family": {
ret.push({
key: "font", value: value.split(',')[0].replace(/"|^'|^\s*|\s*$|'$/g, "").replace(/^([a-z])/g, function (g) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "html-to-pdfmake",
"version": "2.5.0",
"version": "2.5.1",
"description": "Convert HTML code to PDFMake",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit a53b424

Please sign in to comment.