Opened 13 years ago
Closed 13 years ago
#3224 closed bug (fixed)
SVG export scales page content (but not page size) to 333.3% of what it should be.
Reported by: | Alister | Owned by: | mhugent |
---|---|---|---|
Priority: | minor: annoyance | Milestone: | Version 1.7.0 |
Component: | Printing | Version: | Trunk |
Keywords: | Export, SVG, Image, Composer | Cc: | |
Must Fix for Release: | No | Platform: | Windows |
Platform Version: | XP | Awaiting user input: | no |
Description
- Create a composer layout and add a map to it.
- Export as SVG
- Open the SVG in a browser - you will only see the top corner of the map.
- Open the SVG in inkscape - you will see that the page contents (map, north point etc) are all scaled to 333.3% of the size that they should be, but the page is the correct size.
N.B. I'm using the Windows QGIS from the osgeo installer - I don't know if the bug is also present on other platforms.
Attachments (2)
Change History (10)
comment:1 by , 13 years ago
Owner: | changed from | to
---|
comment:3 by , 13 years ago
Oh, I see. It isn't always 333%.
The SVG content is being scaled according to the selected "Quality". It is the correct size if this is set to 90 dpi. (I previously had it set to 300 dpi: 300/90 = 3.33)
comment:4 by , 13 years ago
If you open it with inkscape, you see that the exported size is in pixels and should be correct (of course the pixel size depends on the dpi).
Is there a setting in inkscape to set the dpi of the document? It seems to draw the paper size based on screen dpi (usually around 90). But this is not suitable for printing.
comment:5 by , 13 years ago
I'm pretty sure Inkscape is not the problem. Try this:
- set the Quality to 300dpi
- export as svg
- open the svg in a web browser
You will only see the top left corner of the svg.
by , 13 years ago
Attachment: | mrt_300.svg added |
---|
Minimum reproducible test - 10mmx10mm rectangle on landscape A4 at 300dpi
by , 13 years ago
Attachment: | mrt_600.svg added |
---|
Minimum reproducible test - 10mmx10mm rectangle on landscape A4 at 600dpi
comment:6 by , 13 years ago
I can confirm this bug on QGIS 1.5 and Inkscape 0.47 on Kubuntu 10.04.
It is definitely the SVG export from Quantum, because looking inside a simple SVG, every <g> node has the attribute: transform="matrix(11.8081,0,0,11.8081,0,0)" if it exported at a quality of 300 DPI, and transform="matrix(23.619,0,0,23.619,0,0)" for 600 DPI
comment:7 by , 13 years ago
Playing around with a quick Qt 4.6.0 test app, it seems that the scale issue can be fixed by either setting the source and target areas to be the same, or by setting the viewBox explicitly. The former seems to not scale text properly, and the latter can be achieved by adding:
generator.setSize( QSize( width, height ) ); generator.setViewBox( QRect( 0, 0, width, height ) ); //<-- Add this line generator.setResolution( mComposition->printResolution() ); //because the rendering is done in mm, convert the dpi
to QgsComposer::on_mActionExportAsSVG_triggered()
in qgscomposer.cpp Although I've not yet tried it in QGIS yet.
If I'm not wrong, the problems with svg export in the print composer are well know and are not about QGIS. It should be a QT bug. If I remember well a ticket like this was already filed, please have a look, also among already closed ones.