Suppose I have a layout template in QGIS, with a lot of text boxes like the title of the map, title of the project, a project code, ...

When I export a map in pdf, is it possible to have it named automatically in a name like "Projectcode + Title + Date".pdf ?

If so, how would I go about doing this?


If the values are included in your layer:

you can call them in the printcomposer by going to tab 'Atlas generation'. In the section 'Output' you can define the outputname. In your example it would be:

"Projectcode" ||'_' || "Title" || '_' || day(now())|| '-' || month(now()) || '-' || year(now())

Which gives the result Projectcode_Title_15-01-2019

You can even automaticly add those features in your textboxes by choosing 'insert an expression' in the itemproperties of the textbox.

If the values ar NOT included in a layer:

Add project-variables: go to project > projectproperties (or press Ctrl+Shift+P)

In the section 'variables' add 2 new entries by clicking the green '+' in the right corner. Give them the name 'Projectcode' and 'Title'. Add a value for both.

Now you can call those variables everywhere in your project, also in the composer.

Add the desired textboxes and add following expressions: [% @Projectcode %] and [% @Title%]

For the outputfilename it gives you folowing expression:

@Projectcode ||'_' || @Title || '_' || day(now())|| '-' || month(now()) || '-' || year(now())
| improve this answer | |
  • Hi Pieter, I do not have columns with these names, just textboxes on my layout, how do I link to those? – user115035 Jan 15 '19 at 15:30
  • it is not possible to link textboxes to the outputfilename. But there is another option with project-variables. I will edit my answer – PieterB Jan 16 '19 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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