Some programs add specific content to the title. For example, some Microsoft Word documents will be named “Microsoft Word - filename.docx.pdf” when converted into PDF. If you don’t want to change the filename for every document you create but you want to change they way files created in a certain program are saved, you can use Title Replacement.
To add new Substitutions in the Title Replacement list, simply press + and a new Search Text with empty text will be added to the end of the list. Change the values by clicking on the items. The Search Text may not be empty, else the item will be deleted. Replace with can be empty to remove the Search Text from title. Alternatively you can set a text that will substitute the Search Text. If an item is selected, it can be deleted by clicking on the - button.
There are four types of replacements: The simple search and replace modifies the beginning, the end or all occurances in the title. The more advanced option is the replacement with regular expressions.
You can remove simple additions from the filename automatically by adding a substitution to the list.
When printing from Microsoft Word, the title ususally looks like “Microsoft Word - My Document.docx”. To remove the “Microsoft Word - ” and the ”.docx” from the example, you can add these to strings as Search text and leave Replace with empty, so they will be replaced with nothing. “Microsoft Word - ” can be added as type Start, which only replaces it when the title starts with this value. Add ”.docx” as type End to remove it from the end of titles.
If you need more advanced replacements, you can swtich to the RegEx type.
PDFCreator uses the C# regular expression engine. You can find more information in the Microsoft Regular Expression Quick Reference
With regular expressions, you can do very powerful replacements, once you got used to the syntax.
One user was facing a problem where he would have very long file names when printing images from zip files. The zip application extracted the files to a temporary folder, which led to very long file names as they contained the temporary path, the name of the zip file and the name of the image that was converted.
This regular expressions solves the problem:
Here, we have two parts. The first is everything till ”.zip” which has to be found at least once as. The second is a capture group that contains the rest of the title if it is not empty. Our replacement just contains the group, so the whole zip filename will be omitted.
If this expression does not match the actual title (i.e. it does not contain ”.zip”) or does not have any characters afterwards, the original title will be used.
If you are not sure how your regular expression will modify the title, you can use the preview text box to enter a sample title and see if the replacement is done as expected.