Closed nowrap closed 3 years ago
Ok, #128 says font-weigths only in prosa. So font-weight="bold" works
See my comment on #128. A pull request would be very welcome. I'm closing this as duplicate of #128.
Thanks for reviewing the issue. The font-weight was the minor part. What about the image pattern?
Ah sorry, didn't read that part, so much text :D I will have a look at this tomorrow.
Thx alot! And sorry for the amount of text (mainly the image pattern source). If i can provide any help, please let me know.
This can be simplified, of course - unfortunately the playground strips away the image...
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="500px" height="500px" viewBox="0 0 100 100">
<defs>
<pattern id="img" height="100%" width="100%" patternContentUnits="objectBoundingBox">
<image height="1" width="1" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==" />
</pattern>
</defs>
<rect x="5" y="5" width="90" height="90" fill="url(#img)" stroke="black"/>
</svg>
I cannot reproduce the issue with either of the samples outside the playground. @nowrap could you share a complete repro including the JavaScript code?
Moin, i just put my svg code into the svg2pdf playground: http://raw.githack.com/yWorks/svg2pdf.js/master/
The svg should look like this: https://www.nowrap.net/github/nowrap.svg
But the playground "ignores" the image pattern (screenshot): https://www.nowrap.net/github/nowrap.png
The same happens with the simplified version from @yGuy https://www.nowrap.net/github/yguy.svg https://www.nowrap.net/github/yguy.png
i can try to make a sample project with both svgs
Regards nowrap
The playground will remove image tags for privacy/security reasons, as I indicated, already. Hence the playground is not helpful in diagnosing. You can use the playground locally and remove /disable the DOMSanitizer.
Ok, you are right @yGuy the playground removes all nodes with xlink:href or href attributes: https://github.com/yWorks/svg2pdf.js/blob/master/playground/index.js
I created a demo with our two SVGs and it works! https://www.nowrap.net/github/
It uses the newest versions of jspdf and svg2pdf
Sorry for chasing a phantom ;(
No problem. We should probably improve the playground in this regard,
Hello, @nowrap when i try use your code with little modification to save result as pdf file i get blank document.
pdf.svg(svgElement, { width, height }) .then( () => document.getElementById('pdf-iframe').setAttribute('src', pdf.output('datauristring')), pdf.save('myPDF.pdf') );
@HackbrettXXX I have a svg file with multiple data:image/png;base64 which I try save to pdf file: https://github.com/szykuc/svg/blob/main/unit.svg
@szykuc
output
(or save
, which calls output
) only once per document.display: none
or visibility: hidden
Hello, i am trying to convert a generated SVG to PDF. I looks fine as SVG in chrome: `
`
But the left path with the image isn't rendered to the pdf. And the headline with font-weigth isn't really bold in the pdf.
Maybe someone can put some light on this issue ;)
Regards nowrap
PS I tried the posted svg src in the latest Svg2pdf Playground today