Skip to content

Commit

Permalink
added support link, linkToPage and linkToDestination for SVG #2770
Browse files Browse the repository at this point in the history
  • Loading branch information
liborm85 committed Nov 1, 2024
1 parent 8fd14b1 commit 52a09cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Unreleased

- Added support PDF/A and PDF/UA (see [documentation](https://pdfmake.github.io/docs/0.3/document-definition-object/pdfa/))
- Added support `link`, `linkToPage` and `linkToDestination` for SVG
- Update pdfkit to 0.15.1
- Fixed bug with how page breaks provoked by cells with rowspan were handled
- Fixed find where previous cell started with row span and col span combination
Expand Down
11 changes: 11 additions & 0 deletions src/Renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,17 @@ class Renderer {
};

SVGtoPDF(this.pdfDocument, svg.svg, svg.x, svg.y, options);

if (svg.link) {
this.pdfDocument.link(svg.x, svg.y, svg._width, svg._height, svg.link);
}
if (svg.linkToPage) {
this.pdfDocument.ref({Type: 'Action', S: 'GoTo', D: [svg.linkToPage, 0, 0]}).end();
this.pdfDocument.annotate(svg.x, svg.y, svg._width, svg._height, { Subtype: 'Link', Dest: [svg.linkToPage - 1, 'XYZ', null, null, null] });
}
if (svg.linkToDestination) {
this.pdfDocument.goTo(svg.x, svg.y, svg._width, svg._height, svg.linkToDestination);
}
}

renderAttachment(attachment) {
Expand Down

0 comments on commit 52a09cf

Please sign in to comment.