Skip to content

Commit

Permalink
2.4.15
Browse files Browse the repository at this point in the history
  • Loading branch information
Aymkdn committed Jan 24, 2023
1 parent 5ea1b13 commit 9c4a5a2
Show file tree
Hide file tree
Showing 8 changed files with 911 additions and 890 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.4.14.js

This file was deleted.

1 change: 1 addition & 0 deletions docs/browser-2.4.15.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.14.js"></script>
<script src="browser-2.4.15.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.
10 changes: 8 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -456,20 +456,26 @@ function htmlToPdfMake(htmlText, options) {
break;
}
case "A": {
// the link must be applied to the deeper `text`
// the link must be applied to the deeper `text` or stacked element (e.g. `image`)
var setLink = function(pointer, href) {
pointer = pointer || {text:''}; // for link without any text
if (Array.isArray(pointer.text)) {
return setLink(pointer.text[0], href);
} else if (Array.isArray(pointer.stack)) {
// if we have a more complex layer
pointer.stack = pointer.stack.map(function(stack) {
return setLink(stack, href);
});
return pointer;
}
// if 'href' starts with '#' then it's an internal link
if (href.indexOf('#') === 0) pointer.linkToDestination=href.slice(1);
else pointer.link = href;
pointer.nodeName = "A";
return pointer;
}
if (element.getAttribute("href")) {
ret = setLink(ret, element.getAttribute("href"));
ret.nodeName = "A";
}
break;
}
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.14",
"version": "2.4.15",
"description": "Convert HTML code to PDFMake",
"main": "index.js",
"scripts": {
Expand Down
Loading

0 comments on commit 9c4a5a2

Please sign in to comment.