deeplook / svglib

Read SVG files and convert them to other formats.
GNU Lesser General Public License v3.0
311 stars 80 forks source link

svg convert to pdf with gray images #291

Closed hbh112233abc closed 2 years ago

hbh112233abc commented 3 years ago

svg image temp1629451352.8199928.svg.zip convert to pdf temp1629451352.8199928.pdf

env: win10 64bit python 3.7 64bit svglib 1.0.1

demo:

from svglib.svglib import svg2rlg
from reportlab.graphics import renderPDF

svg_file = 'temp1629451352.8199928.svg'
pdf_file = 'temp1629451352.8199928.pdf'

drawing = svg2rlg(svg_file)
renderPDF.drawToFile(drawing, pdf_file)

error display 微信截图_20210823115413

And I use cairosvg convert pdf not found this problem!

deeplook commented 2 years ago

You don't provide much information except for the files. But I assume you don't expect the upper left black labels to be where they are, and I guess they are a copy of the lower right red ones. Can you strip down the SVG to a minimal size that shows this effect, please?

victorbnl commented 2 years ago

Opening it in Firefox gives

bildo

So I think that's the expected output

hbh112233abc commented 2 years ago

Opening it in Firefox gives

bildo

So I think that's the expected output

the problem is the output pdf file has error! the svg image not found error!

deeplook commented 2 years ago

@hbh112233abc You can help debugging by minimizing your SVG to a version that shows the undesired effect.

claudep commented 2 years ago

I tried with most recent svglib version and the output looks a lot nicer now.