DelazJ / MapsPrinter

A QGIS plugin to export simultaneously multiple print layouts to various file formats
GNU General Public License v3.0
23 stars 6 forks source link

One out of twenty layouts cannot be printed to pdf #53

Closed magerlin closed 1 year ago

magerlin commented 1 year ago

I have a QGIS project with 20 layouts of which one cannot be printed to PDF (but it can be printed to PNG). All layouts are very similar.

Error message is:

Exporting layout '10 Vehicle lost time zoom' Traceback (most recent call last): File "C:\Users/MAP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\MapsPrinter\processing_provider\export_layouts_from_project.py", line 163, in processAlgorithm result = self.processor.exportCompo(cView, outputFolder, title, extension, feedback=feedback) File "C:\Users/MAP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\MapsPrinter\processor.py", line 97, in exportCompo exportSettings = self.overrideExportSettings(cView, extension) File "C:\Users/MAP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\MapsPrinter\processor.py", line 212, in overrideExportSettings exportSettings.exportThemes = layout.customProperty('pdfExportThemes') TypeError: str cannot be converted to a C/C++ QStringList in this context

I am using QGIS version 3.30.2-'s-Hertogenbosch and Maps Printer version 0.9 Under Windows 10

Skærmbillede 2023-05-24 213621 Skærmbillede 2023-05-24 213644

DelazJ commented 1 year ago

All layouts are very similar.

Actually, not really. That specific layout had one day been exported using the default export tool and had had geopdf options enabled, with probably some map themes selected. The fix:

  1. You don't need/want the themes in your pdf: export that layout one more time using the standard way and when the PDF export options dialog pops up, uncheck the themes option. The new settings are saved upon exporting and will be used by maps printer then.
  2. You want themes in your PDF: in "C:\Users/MAP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\MapsPrinter\processor.py", line 212, replace

    exportSettings.exportThemes = layout.customProperty('pdfExportThemes')

    with

    exportSettings.exportThemes = layout.customProperty('pdfExportThemes').split("~~~")

    And restart QGIS.

I didn't plan to release a new version soon, but..