deeplook / svglib

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

Axis details and legend are not shown for EPS but they appear in the PDF for the same svg. #348

Closed ahmad88me closed 2 years ago

ahmad88me commented 2 years ago

Converting the SVG to the EPS loses the legend and the numbers on the axis. But that does not happen when converting the same SVG to PDF.

SVG: t2dv2_mer_exact_reo_ca_nc-rec

Screenshot: (left is the PDF version and the right one is the EPS version) Screenshot 2022-05-30 at 10 26 54 AM

github-actions[bot] commented 2 years ago

Thank you for raising your first issue! Your help to improve svglib is much appreciated!

ahmad88me commented 2 years ago

The source code used:

drawing = svg2rlg(src_file)
if output_format.lower() == "pdf":
    renderPDF.drawToFile(drawing, dest_file)
elif output_format.lower() == "eps":
    renderPS.drawToFile(drawing, dest_file)
claudep commented 2 years ago

I'm afraid this may be a ReportLab issue (as the PDF looks OK). @replabrobin, any idea about what could explain such a difference?

replabrobin commented 2 years ago

It looks like a font issue. I cannot debug without the right svg, but when I view it in chrome I just see a black rectangle. I assume it must be right so I I will attempt the conversions.

replabrobin commented 2 years ago

OK the original svg has a problem somewhere. I tested various output formats including png, pdf, eps, py only pdf showed the text. If I generate svg using eg --outdir=../ --formats=svg then 1) the generated svg can be seen properly in chrome and 2) most of the outputs converted from it show the text. Interestingly eps still doesn't.

This example has too many bits to debug properly. Everythiing in it is just curves so it can't be a font issue, but it might be opacity/colour handling etc etc.

ahmad88me commented 2 years ago

This SVG is generated using pandas (and seaborn). I have several different SVG files generated in the same way all having the same issue. (just in case this info helps).

claudep commented 2 years ago

I'm afraid that svglib is not able to impact the issue with EPS rendering, sorry.