0

I would like to use an SVG in the QGIS Plot Layout. I am using an HTML Element to display a simple SVG, sized using mm units.

The SVG does not seem to display with the desired dimensions. I have removed the margin and padding using a user-defined CSS, but the SVG (green background), does not fill the HTML element (blue background). the SVG shuld be 100 mm wide/high but is only about 90mm.

I have also tried with width:100mm;height:100mm and width:100%;height:100% which did not alter the result.

In the screenshot you can see the SVG and CSS settings.

Does anyone have any tips?

enter image description here

1 Answer 1

0

This is not neccesarily a QGIS issue - I have learned more about SVG and CSS. Units in 'mm' do not necessarily translate to the screen as expected.

I have obtained the desired result by using a unitless SVG, with a viewBox which defines the image extents to match the contents (see image below). The height and width are not set. The svg is embedded in the html and fills the QGIS Template nicely - which is set at 100mm width and height. I was over-complicating in my first attempt. This solution may help someone in the future.

Working Solution

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.