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

Atlas controlled layout overwriting itsself #51

Closed WouterImpens closed 1 year ago

WouterImpens commented 2 years ago

The problem occures when exporting an atlas to a single pdf, with multiple pages. The QGIS function in the layout is working fine but when I try to automate the process with Maps Printer, there's only a pdf with the last page. By watching the process, I can see that all the pages are made but they overwrite themselves.

The bulk export of multiple atlas layouts with the 'maps printer plugin' used to work fine in the past, It's not clear to me why it is not working now.

I’m using QGIS 3.16.14 on windows,and the Maps Printer 0.9 version.

Thanks for looking in to this! Wouter

DelazJ commented 2 years ago

@WouterImpens Thanks for reporting. I've read in the user list that running from the console neither works. Did i misunderstand? What does output a print(layout.customProperty('singleFile')) in your for loop? Is the layout you want to print newly created or an old one (created in an earlier version)? If the latter case, can you test with a newly created layout, please?

DelazJ commented 2 years ago

Also, by with multiple pages, you mean the layout has many pages (hence many pages for each iterated feature in the pdf), or are you talking about the PDF output which has many pages (one for each feature)?

WouterImpens commented 2 years ago

Creating a new atlas seems to solve the problem, the layouts were older.

Thanks for looking into it!

DelazJ commented 2 years ago

You are welcome. But this is a workaround, not a fix as noone should have to redo their layouts to get them exported. Though maybe unchecking then checking the single file checkbox could also have fixed the issue. Anyway... could you please provide answers for whether the console use also failed and the output of the print command? I need to know if the issue is due to some recent initialization changes that landed in QGIS, or to the plugin. Thanks.

WouterImpens commented 2 years ago

I've used the following code:

_import qgis.core layouts_list = QgsProject.instance().layoutManager().printLayouts() for layout in layouts_list: QgsLayoutExporter.exportToPdfs(layout.atlas(), 'C:\Users\d08909\Documents\01_WERKMAP\03EXPORT\', QgsLayoutExporter.PdfExportSettings())

But the result was exactly the same using Maps Printer. I tried a lot of things before posting this issue, like reconfigureing the atlas I've updated QGIS and the plugin, so it's not clear te me where it's going wrong.

DelazJ commented 2 years ago

This is also the command Maps Printer uses in the background so if it does not work, (py)QGIS is probably the culprit here. Can you tell me the output of the following code for both the working and not working layouts, please?

import qgis.core
layouts_list = QgsProject.instance().layoutManager().printLayouts()
for layout in layouts_list:
    print(layout.name(), layout.customProperty('singleFile'))
WouterImpens commented 2 years ago

It gives a True for alle layouts - old and new

DelazJ commented 2 years ago

Ouch... This is not what i expected. It's True as a boolean for both? not 'true' and True? If True for both and one does not export, that's Weird. Here my handling: https://github.com/DelazJ/MapsPrinter/blob/5cdac052df79b1115212dde5d2f4560eb42dbb8d/MapsPrinter/processor.py#L112-L115

Did you touch the "export to single file" checkbox of the failing layout in 3.16.14? and are you sure that it still does not export correctly right now (with code sample and maps printer)? Sorry to insist, I do not have a pre-3.16.11 atlas layout I could test with and I'm suspecting this issue would have something to do with #44 (follow the associated links)

DelazJ commented 1 year ago

Closing. This issue was somehow fixed.