Closed Nowass closed 2 years ago
Asciidoctor PDF 1.6.0 does not support loading an image in an SVG from a data URI. Support for that feature was added in the upcoming Asciidoctor PDF 2.0.0 release. So I believe this question does not pertain to prawn-svg. Though it is curious that we still need a workaround for this in Asciidoctor PDF. See https://github.com/asciidoctor/asciidoctor-pdf/blob/main/lib/asciidoctor/pdf/ext/prawn-svg/loaders/data.rb Seems to be a regex issue.
Aha, the reason we have the workaround is because prawn-svg does not allow image/jpg (it only looks for image/jpeg). However, that doesn't impact this case.
I really don't understand why this works with Asciidoctor PDF 2 but not Asciidoctor PDF 1.6.0. The two code bases have diverged substantially, so it's not easy to nail down. I recommend Asciidoctor PDF 2 (currently unreleased) if you need this working right away. I don't have time at the moment to figure out what the problem might be.
Hi @mojavelinux , thanks for the fast reply!
I am a bit wondering ... you mentioned, that loading an image in an SVG from a data URI is not supported in 1.6.0 and will be added in the 2.x version ... from my experience, the attached image was rendered fine already in 1.5.x version ... does it means, there was "removed/changed" such functionality in 1.6 and will be working again in 2.x version?
I didn't try to run version 2.x yet ... but anyway ... if this version solves this issue, it is ok for me to stay with 1.5.x version until the 2.x will be released.
It was a previously undocumented feature. What I do know is that the release notes for Asciidoctor PDF 1.6.0 state:
upgrade to prawn-svg 0.32...which adds support loading embedded images from a data URI
So clearly there was a point when it didn't work, or we didn't have tests for it. And the data loader in prawn-svg is definitely being called in Asciidoctor PDF 1.6.0. The image is just not showing up. I don't know why.
There are a lot of different parts at play here, and there have been a lot of changes all around. I cannot begin to tell you why it stopped working in Asciidoctor PDF 1.6.0, but still works in Asciidoctor PDF 2. If someone is willing to do that research, maybe we can find out. As I said, I don't have the time for it right now.
Ok, clear ... thanks for the explanation ;-) I'll stay with 1.5 and wait for Asciidoctor PDF 2 release. Thanks for your work!
then maybe I can close the issue, right?
Hello,
I am using asciidoctor to create PDFs. I'm using the MS Visio for SVG image generation and I didn't have any troubles at all up to now. With the latest prawn-svg version, some of them are not rendered correctly and the PDF output is "somehow" broken.
I saw some info that the latest update of the prawn-svg module change the approach to how the SVG images are rendered, but frankly speaking, I didn't find exact details about it.
Currently, I have two kinds of the same SVG image ... one generated from Visio and the second one created in the Inkscape. They hold the same graphical information (some bitmaps inside), but they are completely different from the data point of view. The one from the Inkscape is rendered correctly, but the second from the Vision doesn't.
My current setupt:
NOTE1: Not all SVG images generated by the MSVisio can't be rendered. Some of them still work fine and can be rendered. NOTE2: I also recognize that once the PDF is generated, not all viewers behaves exactly the same ... I did try viewers listed below with the following results on the PDF containing the image generated by Visio:
I have a lot of images and I would like to know the root cause before I'll regenerate/recreate all of them.
Can anyone help me understand which parameter of the SVG causes such behavior, please? You can see a small example in the attachment.
SVGrendering.tar.gz