Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some SVG images aren't render correctly #85

Closed
Nowass opened this issue Dec 1, 2016 · 11 comments
Closed

Some SVG images aren't render correctly #85

Nowass opened this issue Dec 1, 2016 · 11 comments

Comments

@Nowass
Copy link

Nowass commented Dec 1, 2016

Hi,

I use MS Visio for SVG images creation, but these images are not correctly rendered in generated PDF output. The problem is mainly with the multi-line text where all the lines are generated in one line. Other problems are the arrows at the end of the lines.

If the same (very similar) image is created for example in LilbreOffice Draw, the output is ok. I've tried a lot of other tools for SVG images (Google draw, Smart Draw, Inkscape, Pencil, ...) and so far it seems that the problem is only with the Visio images.

See attachment with PDF output example.

Do you have any idea what can be wrong?

Thank you,
Petr
svgTest.pdf

@mogest
Copy link
Owner

mogest commented Dec 1, 2016

Hi Petr, sorry to hear you're having troubles with prawn-svg. Would you be able to attach an example SVG file that shows the problems you're experiencing please?

@Nowass
Copy link
Author

Nowass commented Dec 1, 2016

Hi,
thanks for fast reply.

I've tried several svg outputs of one image exported from MS Visio, but none of them is working properly for me. Then the Visio drawing imported into LibreOffice Draw -> exported to SVG works (libreDraw.svg). See attachment.

P.S. the cleaned version is generated by the SVG cleaner

images.zip

Thanks,
Petr

@mogest
Copy link
Owner

mogest commented Dec 1, 2016

Thanks Petr! I've taken a look at the SVG output and found two bugs in prawn-svg:

  1. This SVG specifies distance in em units, which prawn-svg doesn't support.
  2. [edit] prawn-svg doesn't apply classes specified on the top-level <svg> element

I'll try to look into fixing these problems this weekend, but please excuse me if it's a bit longer.

@Nowass
Copy link
Author

Nowass commented Dec 1, 2016

Perfect! Sounds good :o)

Many thanks for your fast support!

Have a nice day.
Petr

@mogest mogest closed this as completed in a287d71 Dec 3, 2016
mogest pushed a commit that referenced this issue Dec 3, 2016
Styles defined in <style> elements apply globally, even to elements
above the <style> blocks.

Partially fixes #85.
mogest pushed a commit that referenced this issue Dec 3, 2016
Previously elements rendered because of a <use> element were not using the
<use> element's properties and state.

Partially fixes #85.
@mogest
Copy link
Owner

mogest commented Dec 3, 2016

Turned out there were three problems, that has to be a record for a single SVG file!

I'd appreciate it if you could try it out by referencing prawn-svg directly from the github repo:

gem 'prawn-svg', git: "https://github.com/mogest/prawn-svg.git"

and let me know if you have any troubles with this one! Thanks.

@Nowass
Copy link
Author

Nowass commented Dec 5, 2016

Hi,
I've just quickly played with your update and so far so good. I'll check it more deeply within today and let you know :o)

Many thanks for your quick support!
Petr

@Nowass
Copy link
Author

Nowass commented Dec 5, 2016

So I did more deep crosscheck on my other drawings, and I have to say that the multi-line problem is fixed and now it works perfectly.

but ... unfortunately, I found out other problems ...

in some of my drawings, the elliptical arc is not rendered correctly (see attached PDF). After several trials, I was able to find out the conditions which cause the problem. It always occurs , when the arc is scaled. If the original size is used, then it works well. So far it seems that the problem is only with this one shape, but frankly speaking, I did check only a few basic shapes and lines.

Do you have an idea what can be wrong?

lines.zip

I am not sure, if the next problem I am facing with, belongs to your module ... but anyway ...
The problem is the dotted line. Visio interprets this element as a sequence of lines with zero length. From my understanding, zero length should be represented as a single point. But in this case, I'll get an error that the zero length is not allowed. Up to now, I find out two ways how to handle this problem, but no one is really nice. The first option is to manually change the zero length to for example 0.01 and then it works ... but this means some image post processing every time it changed ... and this is not acceptable in the real project. The second one (the simplest) is to set a rule that dotted lines are forbidden ... then, for sure, there is no problem :o)

Do you have an idea how to deal with ?

@Nowass
Copy link
Author

Nowass commented Dec 5, 2016

just a small update ... the second issue (zero length line) should belong to prawn module ... so it is not for you :o)
Petr)

@mojavelinux
Copy link
Contributor

@Nowass we could patch that in Asciidoctor PDF.

@Nowass
Copy link
Author

Nowass commented Dec 5, 2016

@mojavelinux this would be great!
I already put a comment here:

prawnpdf/prawn@e65c244

so I hope I didn't create too many mismatches :-)

Thanks!
Petr

@mogest
Copy link
Owner

mogest commented Dec 16, 2016

I've created a new issue for the scaled arcs not appearing correctly, #87, and will take a look when I can! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants