Closed flyme2bluemoon closed 3 years ago
Also, converting svgz file to pdf raises the following error:
Rendering failed.
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/svg2pdf", line 129, in <module>
_main()
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/svg2pdf", line 125, in _main
svg2pdf(path, outputPat=args.output)
File "/Library/Frameworks/Python.framework/Versions/3.8/bin/svg2pdf", line 38, in svg2pdf
drawing = svglib.svg2rlg(path)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/svglib/svglib.py", line 1442, in svg2rlg
shutil.copyfileobj(f_in, f_out)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/shutil.py", line 202, in copyfileobj
buf = fsrc_read(length)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/gzip.py", line 292, in read
return self._buffer.read(size)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/_compression.py", line 68, in readinto
data = self.read(len(byte_view))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/gzip.py", line 479, in read
if not self._read_gzip_header():
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/gzip.py", line 427, in _read_gzip_header
raise BadGzipFile('Not a gzipped file (%r)' % magic)
gzip.BadGzipFile: Not a gzipped file (b'<s')
Hi Matthew, having access to the source files is mandatory to debug your issues.
Hey Claude,
I wasn't able to upload the svg directly but here is a ZIP file containing the SVG file.
Thanks for looking into it!
With the suggested pull request, the text now appears.
However your next issue might be embedded fonts. Are the embedded woff fonts PostScript otf or TrueType ttf? Reportlab currently doesn't support PostScript fonts, so there is nothing we can do in that case.
About the svgz issue, the problem is that your file is not compressed, so this is a svg file not a svgz one.
Hey Claude, thanks so much for all the help! So, how can I update it using pip3? Also, can I just take the svgz file and rename it with the svg file extention? Thanks again!
As soon as the patch is committed (when the tests finish), you should be able to pip-install it (see https://adamj.eu/tech/2019/03/11/pip-install-from-a-git-repository/).
Yes, you can simply rename the svgz extension to svg.
My stance about font support is not totally right, as there are tools (like https://github.com/fonttools/fonttools) that allow for font format conversion. However this is a rather big task, not planned in the short term.
I'm not sure what fonts are used in the SVG since I didn't create them.
Trying to convert svg file to pdf file. Although it converts images properly, the text is missing in the pdf. Using Python 3.8.2 on macOS Catalina 10.15.6. Installed svglib using pip3.