Bug report #3224
SVG export scales page content (but not page size) to 333.3% of what it should be.
|Affected QGIS version:||Regression?:||No|
|Operating System:||Windows||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||13284|
- 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.
#4 Updated by Marco Hugentobler almost 10 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.
#6 Updated by JD - almost 10 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
#7 Updated by JD - almost 10 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