Skip to content

Commit

Permalink
v2.4.24
Browse files Browse the repository at this point in the history
  • Loading branch information
Aymkdn committed Aug 22, 2023
1 parent 0276957 commit 1dd4b96
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion browser.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/browser-2.4.23.js → docs/browser-2.4.24.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.4.23.js"></script>
<script src="browser-2.4.24.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
Binary file modified example.pdf
Binary file not shown.
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ function htmlToPdfMake(htmlText, options) {
this.setRowSpan = function(params) {
var cells;
if (params.cell.rowSpan) {
for (var i=1; i <= params.cell.rowSpan-1; i++) {
var len = params.cell.rowSpan;
for (var i=1; i <= len-1; i++) {
cells = (params.rows[params.rowIndex+i].text || params.rows[params.rowIndex+i].stack);
if (cells) cells.splice(params.cellIndex, 0, {text:''});
else {
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.4.23",
"version": "2.4.24",
"description": "Convert HTML code to PDFMake",
"main": "index.js",
"scripts": {
Expand Down
31 changes: 31 additions & 0 deletions test/unit.js
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,37 @@ test("unit tests", function(t) {
t.finish();
})

t.test("multiple empty TR after rowspan",function(t) {
var html = `<table>
<tbody>
<tr>
<td>A</td>
<td>B</td>
<td>C</td>
</tr>
<tr>
<td rowspan="4">AA</td>
<td rowspan="4">BB</td>
<td rowspan="4">CC</td>
</tr>
<tr></tr>
<tr></tr>
<tr></tr>
</tbody>
</table>`;
var ret = htmlToPdfMake(html, {window:window});
if (debug) console.log(JSON.stringify(ret));
t.check(Array.isArray(ret) && ret.length===1, "return is OK");
ret = ret[0];
t.check(
ret.table &&
Array.isArray(ret.table.body) &&
ret.table.body[0].length === ret.table.body[1].length,
"basic test");

t.finish();
})

t.test("inherit css styles",function(t) {
var html = `<div style="color:red;"><span style="color:blue">blue<strong style="color:green">green</strong>blue</span><span>red</span></div>`;
var ret = htmlToPdfMake(html, {window:window});
Expand Down

0 comments on commit 1dd4b96

Please sign in to comment.