How to hide document codes in PDFs using Affinity Publisher/Designer

Clients may rename your PDFs and email them back with notes. You can easily search for the source files by including document codes with Affinity Publisher.

By Squirrel Logic on Feb 28, 2025

How to hide document codes in PDFs using Affinity Publisher/Designer

Clients may rename your design files

Which is fine. Clients have autonomy and may rename the file for their own purposes. But the client may send the PDF to you in an email asking you to make changes. You search for the filename, but it doesn’t match anything you have.

You can try insisting that the client doesn’t rename the designs you create for them, but employees may not get the memo, people forget, or your naming scheme isn’t the best fit for them.

You need a fool-proof system: a system that lets people rename the files but also lets you easily search for the original source to make edits.

There are two solutions.

  1. You can use an expensive Document Management System, but now you are forcing a business to change how they work. A system like that may be overkill.

  2. You can include hidden document codes inside the PDF where people can’t change it.

How to include document codes using Affinity Publisher

If it’s an Affinity Publisher file, this is pretty easy to do. From the main menu:

  • Window > References > Fields
    • If it’s not already checked, click on “Fields” and it will open the fields panel.
    • If it’s already checked, that means the UI panel is already open, but may not be a tab in another panel and not focused. You just need to find where the Fields panel is in your UI.

You’ll have a few fields that you can edit. The ones that will show up in the Foxit PDF Reader are:

  • Author
  • Tags
  • Title
  • Subject

We like to include the document code in the “Title” field.

Once you’ve added your document code to one of those fields, save your file. When you export the PDF, that information will be saved as metadata in the PDF.

More on how to access that metadata and search for the document code later.

How to include document codes using Affinity Designer

Designer doesn’t have a way to do this directly. Fortunately, you don’t have to create all your documents in Affinity Publisher for this to work.

So long as you also have Affinity Publisher installed, from Affinity Designer do the following:

  • File > “Edit in Publisher…”
  • Go to the Fields panel and add the metadata there.
  • File > “Edit in Designer…”
  • Save.

Your file is still technically a Designer file, but it has the extra metadata saved from Publisher. You can even export the PDF from Designer and it will still have the Publisher metadata.

How to view the document code hidden in the PDF

We use Foxit PDF Reader, but this should work in Acrobat as well.

From Foxit, open the PDF and go to File > Properties.

And there it is! The document code is saved, even if the client renames the file.

How to choose a document code

The most important thing for us is to keep the code unique and easily searchable.

Our “document code” is the original name of the file, formatted like this:

File Name YYYY-MM-DD

That’s it. Here’s an example:

Source File:   File Name 2024-12-31.afpub
PDF File:      File Name 2024-12-31.pdf
Document Code: File Name 2024-12-31

This method means we don’t have to think about unique document codes. It’s really not a document code at all. It’s just saving the original file name in the PDF so we can find it if the client renamed the file. Our internal design document nomenclature is that we don’t use version numbers, just the date the document was finalized.

How to search using the document code

Because the document code is the original file name, just copy and paste the text in the Title field from Foxit or Acrobat into your file explorer’s search, and the original file should come up in the search results.

How to enforce this process in your design agency

Checklists

We use a lot of checklists for stuff like this.

Whenever we complete a project, there’s a checklist of tasks we need to do before signing off on a project and delivering it to the client: proofreading, cleaning up old revisions, that sort of thing.

One of those tasks is to make sure we open the file in Affinity Publisher, update the Title field to match the file name, and then save it.

It’s not fool proof, but the process routinely saves us a lot of time.

Adobe Illustrator does this automatically

Illustrator automatically updates and saves the Title metadata to match the file name. So if the PDF was created with Illustrator, just look at the Title metadata in the PDF to find the original file name.

It’s just Affinity Designer and Publisher that doesn’t do this automatically.

Wait, doesn’t Affinity Designer and Publisher do this automatically?

Yes, but there’s a huge caveat!

When you save the file in Designer/Publisher, it sets the title metadata to be the file name. However, this only happens once. If you hit “Save As” to create a new file, Designer/Publisher won’t update the title to match the new file name.

The title is automatically set once, but it is not updated after that. You have to go in and update it yourself if the file name changes. And because we’ll often create a new design by starting with an existing one, this is most of the time.

Is there a way to fully automate this?

We’ve done some testing with ExifTool, a library and command line application that lets you edit metadata found in a lot of file formats, including PDF.

You can write a script that will update the Title like so:

exiftool -Title="Title Goes Here" file.pdf

You can also use ExifTool to modify the Author, Subject, and so on.

We haven’t created software that will make this process easier yet, but ExifTool is worth mentioning as a good option, especially if the designs are made in Affinity Designer where the metadata fields are not accessible.

We use PowerShell scripts to do this type of automation. A drag-and-drop app would be nice.

Either way, a project checklist is already part of our process. So we stuck with what already works to make sure our design files have that metadata.

Share: