yWorks/svg2pdf.js

Add multiple SVG to PDF

iziorama opened this issue · 2 comments

Issue Description
When I'm trying to add more then one svg to the .pdf document, all svg graphics placed on one page and it's elements occluding and masking each other. As well it doesn't respect current page of the doc.

svg2pdf -2.2.0
jspdf – 2.5.1

To Reproduce

  1. Add first svg to the pdf document using svg2pdf
  2. Add page to the document with jspdf
  3. Add second svg to the pdf document using svg2pdf
  4. In the resulted pdf document both svg graphics will be placed to the same page and occlude

Example link

Expected behavior
Graphics of the SVG should be added to the PDF document.

Desktop (please complete the following information):

  • OS: MacOS 10.15.17
  • Browser: Safari
  • Version: 15.5
yGuy commented

The example link points to the playground which does not support adding multiple svgs and multiple pages.
Can you please update the example link to actually show the problem? There need to be multiple calls to pdf.svg() in order for this to work.

@yGuy when I'm tried to build example I've found the root cause of the issue.
Function that contains jsPdf methods should be async and all pdf.svg() should have await keyword.

Here is the working example:
https://jsfiddle.net/iziorama/w2t0po5e/93/