deeplook / svglib

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

Upgrading from SVGLIB 0.8.1 to 0.9.2 Breaks - SVG Images Now Appear in Black and White #211

Closed louis-gallo-cigna closed 5 years ago

louis-gallo-cigna commented 5 years ago

(I first posted this issue last year, but decided not to upgrade until now.)

I have been using SVGLIB 0.8.1 for a few years now to incorporate existing color SVG chart images (created in R) into a PDF file. It has worked great.

When I try to upgrade to the latest SVGLIB 0.9.2, on a clean Windows machine with Python 3.6.1, my imported SVG images (which are fine themselves) now appear in black and white once imported in the PDF file.

I also get this error when executing SVGLIB commands:

Unable to find a suitable font for 'font-family:Nimbus Sans L'

I really would like to upgrade SVGLIB. What am I doing wrong here?

Simply upgrading to SVGLIB 0.9.2 causes the process of importing SVG images into PDFs to break. Downgrading back to 0.8.1 returns everything to normal.

from svglib.svglib import svg2rlg
my_canvas = canvas.Canvas(strLinuxMultiserverReportTemporaryFilename)
my_canvas.setPageSize((11.5*inch, 40*inch))
drawing = svg2rlg(image_path)
drawing.transform = (0.25,0,0,0.25,0,0)
intHeaderIndex = 2850
my_canvas.drawString(350, intHeaderIndex, 'System Performance Report')
renderPDF.draw(drawing, my_canvas, intCurrentColumnNumber, intCurrentRowNumber)
my_canvas.save()

I expect my nice color SVG files to be imported into the PDF file by SVGLIB and stay in color.

Any help is greatly appreciated.

Lou

claudep commented 5 years ago

Without a sample SVG file, it is difficult to debug your issue. Could you please upload one?

louis-gallo-cigna commented 5 years ago

Hi Claude,

Absolutely. I can provide an identical SVG created from my 0.8.1 testbed, and one from the 0.9.2 testbed.

Will that work?

I appreciate your response and help.

I’ll send that long shortly.

Thanks,

Lou

From: Claude Paroz [mailto:notifications@github.com] Sent: Tuesday, October 8, 2019 11:15 AM To: deeplook/svglib svglib@noreply.github.com Cc: Gallo, Louis G (Lou) 523 Louis.Gallo@Cigna.com; Author author@noreply.github.com Subject: [External] Re: [deeplook/svglib] Upgrading from SVGLIB 0.8.1 to 0.9.2 Breaks - SVG Images Now Appear in Black and White (#211)

Without a sample SVG file, it is difficult to debug your issue. Could you please upload one?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_deeplook_svglib_issues_211-3Femail-5Fsource-3Dnotifications-26email-5Ftoken-3DAKZK22WSI5CWQZ23KPFKJ73QNSPYRA5CNFSM4I6SSO52YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEAURCFI-23issuecomment-2D539562261&d=DwMCaQ&c=WlnXFIBCT3pmNh_w8hYeLw&r=M312SWSkykO9p3nht3oebquGUSlIKnJTrcP9OKlLoFU&m=SCec1NxtsFJhMKwDT7ORJm6-utiep7TU9ITw41m4auA&s=2vcmA-5uFnvX55oxOGS-VSWFzS_0LFaDYIrgXsJ_eXM&e=, or mute the threadhttps://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AKZK22S4NAGQWOSFH6IQL2DQNSPYRANCNFSM4I6SSO5Q&d=DwMCaQ&c=WlnXFIBCT3pmNh_w8hYeLw&r=M312SWSkykO9p3nht3oebquGUSlIKnJTrcP9OKlLoFU&m=SCec1NxtsFJhMKwDT7ORJm6-utiep7TU9ITw41m4auA&s=ok2AR5oakxyQ8EC0mcO9T6e3cNVnuT1Jyg7fjZ5zzGI&e=.

CONFIDENTIALITY NOTICE: If you have received this email in error, please immediately notify the sender by e-mail at the address shown. This email transmission may contain confidential information. This information is intended only for the use of the individual(s) or entity to whom it is intended even if addressed incorrectly. Please delete it from your files if you are not the intended recipient. Thank you for your compliance. Copyright (c) 2019 Cigna

louis-gallo-cigna commented 5 years ago

Sample SVG enclosed. SVG-Generated-by-R-Version-3.4.4.zip

Thanks,

Lou

claudep commented 5 years ago

Thanks, at least it allowed me to spot the issue. As CSS is now interpreted, it appears there is a precedence bug between the generic CSS in the defs part of the file and the styles included in the elements themselves.