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

Updated July 17, 2025

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

Why would you want to embed document codes into a PDF?

Clients may rename your design files

Which is fine. Clients have autonomy and might rename the file to fit their needs. Maybe your filename was too verbose, didn’t use their terminology, or your version numbers are ugly.

One day the client emails the PDF to you and asks for changes. You search your drive for the filename but nothing comes up because the client renamed it.

Even if you come to a consensus about filenames, insisting that the client never renames the file is not realistic: employees won’t get the memo and people forget.

You’ll want 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 document management system is usually overkill.

  2. You can include hidden document codes (or the original file name) inside the PDF where people can’t change it.

The second option is the obvious winner. But you have to remember to do it.

You can use your design software to add the hidden document code, or you can use a command line tool to do 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 checked, click on “Fields” and it will open the Fields panel.
    • If it’s checked, that means the Fields panel is open in your UI somewhere. You just need to find the panel.

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

  • Title
  • Author
  • Subject
  • Tags (AKA Keywords in your PDF reader)

We like to include the document code in the “Tags” or more accurately the Keywords field. Some clients may notice that the Title attribute doesn’t match the file name. So it’s safest to put the clean document name in the Title, and your document code in the Tags (or Keywords) 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.

We’ll go over 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.
  • 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 included.t

How to include the document codes using command line tools

We are big nerds at Squirrel Logic, and we are not afraid to use command line tools to help our process. Especially because the idea of having to open a Designer file with Publisher to access some missing functionality isn’t intuitive.

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 and Keywords like so:

exiftool -Title="Brochure" -Keywords="Brochure 2025-07-17" "Brochure 2025-07-17.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 consistent option. 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 we want.

Installing ExifTool on Windows

It’s pretty easy to install ExifTool for use in a Windows terminal. Just download the Windows binary, extract it a directory of your choice, rename exiftool(-k).exe to exiftool.exe, and add the path to that EXE file to your PATH variable.

  • Press the Windows key and start typing “Edit the system environment variables.”
  • Click on “Evironment Variables” at the buttom of the “Advanced” tab.
  • Under “User variables for” you username, there will be a “Variable” name called “Path”. Select it and click “Edit…”
  • Click “New” and paste the path to exiftool.exe and click OK.

You may need to restart your terminal app, but you should now be able to run exiftool from anywhere to edit metadata of your files.

How to view the document code hidden in the PDF

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

Foxit: Open the PDF and go to File > Properties.

Acrobat: Open the PDF, right-click on the page, and then click “Document 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 it. You’ll notice we don’t use version numbers, just the date the document was finalized. (During the design process we’ll append -draft-3 as we work on it, but that’s removed when the design is finalized.)

How to search using the document code

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

You may be thinking that you could add the path in the metadata so you wouldn’t have to search for the file, but I’d recommend against that. Files may be reorganized, and directory names could reveal too much information about the project or the client.

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 update the metadata.

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, I’ve seen Affinity Designer and Publisher set the Title automatically

Yes, it does. But there’s a huge caveat!

When you save a file in Designer/Publisher for the first time, it sets the Title to match the filename. However, this only happens once. If you click “Save As,” Designer/Publisher won’t update the Title to match the new filename. You have to manually update the Title going forward. And because we’ll often create a new design by starting with an existing design, this is most of the time.

Share: