Bug report #14644

SVG image in print composer renders incorrectly

Added by Chris York over 4 years ago. Updated over 4 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:Map Composer/Printing
Affected QGIS version:2.14.0 Regression?:No
Operating System:Windows Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:22608

Description

I have just upgraded from 2.8 to 2.14.1 and find that SVG image files inserted into Map Composer does not render correctly - text is placed incorrectly relative to other items in the file and outside the bounding box . It was fine in all previous versions... I have both versions installed concurrently and the issue only occurs in 2.14.1

It is incorrect on screen (see attached screen grab) and when printed.

The SVG was created in Inkscape, but renders correctly in all other programs (screen grab of Map Composer in 2.8.2 also attached).

Hope this is fixable. Many thanks

QGIS2_14_1_SVG.png - SVG as rendered in 2.14.1 (47.1 KB) Chris York, 2016-04-08 09:47 AM

QGIS2_8_2_SVG.png - SVG as rendered in 2.8.2 (and as expected) (54.2 KB) Chris York, 2016-04-08 09:47 AM

qgis_problem.svg - SVG file from Inkscape 0.91 (edited to include viewbox) (24.5 KB) Chris York, 2016-04-12 04:01 AM

bar_TST000000001.svg (20.3 KB) Thomas McAdam, 2016-04-16 10:06 PM

qr_TST000000001.svg (11 KB) Thomas McAdam, 2016-04-16 10:06 PM

Associated revisions

Revision 2265115f
Added by Nyall Dawson over 4 years ago

Fix issues rendering SVG with text (fix #14644, #14794)

Revision 482140bf
Added by Nyall Dawson about 4 years ago

Fix issues rendering SVG with text (fix #14644, #14794)

(cherry-picked from 2265115f8003857e538f07287c1337fed463a39c)

History

#1 Updated by Nyall Dawson over 4 years ago

  • Status changed from Open to Feedback

Can you please make sure your svg has a correct viewbox parameter set? It would also help to attach the svg here.

#2 Updated by Chris York over 4 years ago

Thanks for this suggestion. My Inkscape-generated file did not have a 'viewbox' parameter. I looked it up, edited the file in a text editor and I have inserted one.

In my SVG file the following values are now included (3rd line is new):

width="245"
height="90"
viewbox="0 0 245 90"

However this doesn't change how it is rendered in QGIS 2.14.1 map composer

It appears to be the relative positions of text and vector shapes at issue (all the right notes but not necessarily in the right order!). Because QGIS has previously had no problem with this file suggests to me a change within QGIS, and potentially means that any files I import from Inkscape could be affected...

I'll upload the SVG if that's the only way to fix the problem, but hopefully it's not my file that is key to this problem. The file was created in Inkscape 0.91 and this is the first instance where it has been incorrectly rendered, and I've been using it for years.

Thanks for your help.

#3 Updated by Giovanni Manghi over 4 years ago

  • Target version deleted (Version 2.14)

#4 Updated by Nyall Dawson over 4 years ago

Yes, please upload your svg

#5 Updated by Chris York over 4 years ago

Here's the file, if you are able to see anything unusual, that causes a change between QGIS 2.8.2 and 2.14.1 that would be helpful.

BTW this still works as expected in 2.8.2 since it has had the viewbox statement included.
Many thanks

#6 Updated by Thomas McAdam over 4 years ago

Same issue with 2.14.1 in Ubuntu 15.10. Have tried qgis_problem.svg and get the same issue. These two SVGs are generated by two separate packages, both rendering incorrectly in composer. Showing a very large padding around the image, so the image scales to be tiny in the composer frame. Both appear normally in web browser.

#7 Updated by Giovanni Manghi over 4 years ago

  • Status changed from Feedback to Open

#8 Updated by Diane Perez over 4 years ago

I experienced the same problem, after updating from version 2.14.0 to 2.14.2.
After a few install-uninstall, I am quite sure the problem appears with version 2.14.1. Hope this helps !
Version 2.14.0 is fine.

#9 Updated by Nyall Dawson over 4 years ago

  • Status changed from Open to Closed

#10 Updated by Chris York over 4 years ago

Hi Nyall,
Thanks for working out a fix for this. Much appreciated.
Kind regards

Also available in: Atom PDF