module documentation

QGIS Print template.

The Qgis print templates work this way:

We read the qgis project and locate a template object within by its title or the index, by default the first template is taken.

We find all label and html blocks in the template and create our html templates from them, so that they can make use of our placeholders like @legend.

When rendering, we render our map as pdf.

Then we render these html templates, and create a clone of the qgis project with resulting html injected at the proper places.

Then we render the Qgis template without the map, using Qgis GetPrint to generate html.

And finally, combine two pdfs so that the qgis pdf is above the map pdf. This is because we need qgis to draw grids and other decorations above the map.

Caveats/todos:

  • both qgis "paper" and the map element must be transparent
  • since we create a copy of the qgis project, it must use absolute paths to all assets
  • the position of the map in qgis is a couple of mm off when we combine, for better results, the map position/size in qgis must be integer
Class Config No class docstring; 4/4 class variables documented
Class Object Undocumented
Class _HtmlBlock Undocumented