:tocdepth: 3 :py:mod:`gws.plugin.qgis.template` ================================== .. py:module:: gws.plugin.qgis.template .. autoapi-nested-parse:: 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 **Source code:** :source:`gws.plugin.qgis.template` Module Contents --------------- .. py:class:: Config Bases: :py:obj:`gws.base.template.Config` QGIS Print template configuration. .. py:attribute:: cssPath :type: Optional[gws.FilePath] Css file. .. py:attribute:: index :type: Optional[int] Template index. .. py:attribute:: mapPosition :type: Optional[gws.UomSizeStr] Position for the main map. .. py:attribute:: provider :type: Optional[Config.provider] Qgis provider. .. py:class:: Object Bases: :py:obj:`gws.base.template.Object` .. py:attribute:: cssPath :type: str .. py:attribute:: htmlBlocks :type: dict[str, _HtmlBlock] .. py:attribute:: mapPosition :type: gws.UomSize .. py:attribute:: qgisTemplate :type: gws.plugin.qgis.caps.PrintTemplate .. py:attribute:: serviceProvider :type: gws.plugin.qgis.provider.Object .. py:method:: configure() .. py:method:: configure_provider() .. py:method:: render(tri)