By default, PDF exports are named PDF Export.pdf
.
To configure the filename, change the content of the <title>
element of the pdf-template.vm file.
For example:
The following example checks if a document has the Version_FT
metadata key with a value of Latest
.
If so, the filename is the name of the document ($pbk-title
), followed by the value of the Version_FT
metadata key, followed by the value of the audience
metadata key.
The combination of the three metadata keys is turned to lowercase, with all spaces replaced by underscores.
If not, the filename is the name of the document ($pbk-title
) turned to lowercase, with all spaces replaced by underscores.
<title>
#if($metadata["Version_FT"] != "Latest")
#set($title = "$pbk-title $metadata['Version_FT'] $metadata['audience']")
$title.toLowerCase().replace(" ", "_")
#else
$pbk-title.toLowerCase().replace(" ", "_")
#end
</title>