1

How can I add custom paper sizes to the presets under the Composition tab?

If I save and reuse a template, only the Item properties are saved, not the Composition items, so I have to change the width and height of the paper every time.

2
  • Could you be more specific with your steps? I just customized my paper size and saved the template and reused with all properties i changed preserved. I'm trying to pinpoint where the issue may be with what your doing. Also, which version of QGIS are you using?
    – whyzar
    Commented Feb 21, 2016 at 5:22
  • If you chose custom under the presets you can enter your own dimensions. As for the composition tab you cannot save these settings in a print template (qpt-file) but only in a QGIS project (qgs-file). This looks to me like a WAD (WorkAsDesigned). Not sure what whyzar is saving? I tested in a Fedora QGIS 2.10.1 environment.
    – Jakob
    Commented Feb 22, 2016 at 8:55

1 Answer 1

2

The way I've done it in QGIS3 is via a simple python script that runs on QGIS startup. In the QGIS APPDATA folder (on Windows, this is found via Settings>User Profiles>Open Active Profile folder - then going back up to the QGIS/QGIS3 folder, or %appdata% -> QGIS/QGIS3)

Once you're there. Create a new file called startup.py (or edit the one there if there already is one), edit the file, and add in these lines:

from qgis.core import QgsApplication, QgsPageSize, QgsLayoutSize, QgsUnitTypes

pageSizeRegistry = QgsApplication.pageSizeRegistry()

and then add in the page sizes you want:

pageSizeRegistry.add(QgsPageSize('reportsmall', QgsLayoutSize( 146,245, units=QgsUnitTypes.LayoutMillimeters), 'Report - Small'))

Save it, open QGIS, and your new paper size should be there in the page size options.

You can add a bunch of other page sizes via this method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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