I once had an idea to generate "hidden" qr codes in art and photos. Initially I wanted to take a photo of a giraffe and replace one of its spots with a QR code, and hang it in my living room for guests to scan. It turned into this (broken) website: https://www.qraffe.com/. I don't have a lot of time right now to fix it. The pdf rendering is broken. If anyone likes this idea and wants to help with a PR, I'll be mighty appreciative. https://github.com/joeframbach/qraffe
Hmm, after tinkering around a bit, I think according to https://github.com/yWorks/svg2pdf.js/issues/82 , the mask element in the giraffe SVGs is not supported in the PDF converter. It is just dropped, leafing the qraffe rather qr-less.
But I sadly know neither svg enough to think up an alternative approach, or a JS/TS dev enough to see if there are other libraries.
That is likely the issue. The alternative is to use Lambda to render pdfs on the server side, but I wanted to keep this fully on the client side as a static site (to avoid any trust issues with sending your wifi credentials to strangers). I may have to pay up real $$ if I want to do this "right".
Didn't look at your code but I had good results with using dom-to-pdf with converting quite complex svg's to pdf's cliënt site. Though I remember it needed a trivial fix to render pdf's larger than the current viewport.
You might want to take a look.