Closed alan0526 closed 2 years ago
Thank you for raising your first issue! Your help to improve svglib is much appreciated!
The PNG renderer is known to be limited, see also #299.
Could you tell us what make you think the PDF is not correct? By the way, the method used to draw the logo is not optimal (circle with big stroke and dasharray), SVG has arcs that would be more appropriate and probably more precise.
I want to create a rotated bmw logo with svg, convert it to pdf, and send it to our chart supplier. it is used for camera quality test, so the accuracy is very import. But after I convert this svg to pdf, the pattern looks different. Thanks for you advice, I will try to use arcs to draw this pattern.
here are files base on svg arcs(path) PNG: SVG: PDF: chart.pdf
svg and pdf seems correct, but the png arcs are not very smooth, is there any setting for png generator? png dpi is set to 300
You may try the alternate PNG renderer as in https://github.com/deeplook/svglib/issues/299#issuecomment-918111040. Anyway, there is nothing svglib can do to fix that, therefore closing.
svglib==1.4.1 installed via pip. Python 3.9.2
I use svglib and reportlab to convert svg to pdf and png
Files SVG PDF bmw logo.pdf PNG
Code from svglib.svglib import svg2rlg from reportlab.graphics import renderPDF, renderPM
def svg2pdf(svg_path, path): drawing = svg2rlg(svg_path) renderPDF.drawToFile(drawing, path)
def svg2fmt(svg_path, path, fmt="PNG", dpi=75): drawing = svg2rlg(svg_path) renderPM.drawToFile(drawing, path, fmt=fmt, dpi=dpi)
the converted pdf and png is not correct, both of them are look different.