I have to design a document for internal use that needs a unique serial number on copy of the sign off sheet.

I'm aware that InDesign has a numbering function (to number book/magazine pages) but what I'm looking for is something that's a but smarter than 1,2,3,4... I need it to put out a serial number mixed of letters and numbers preferably adhering to a set pattern.

Is there a way one can insert a variable into a pdf or InDesign doc so that each time it's printed it will print a unique serial number onto that page?

The only other way I could think of doing this was to make a web page html/php and have the serial number done on the server and the print page styled with a print style sheet. But this seems like a rather long way to go around the issue.

  • Maybe you could generate the serial numbers into a text file where each serial number is in their own line ( with the tool of your choice ). Then you could bring that into indesign with data merge.. ( Window > Automation > Data marge ).
    – Joonas
    Commented Dec 13, 2012 at 13:44
  • Is this something that gets submitted as hard copy or electronic only? If electronic, via "website" (e.g. POST to server) or via email? Some sort of company server always on and accessible?
    – horatio
    Commented Dec 13, 2012 at 15:23
  • they are for hard copy sign off sheets, they are going to have boxs to be filled in by hand and then sent out in the post with a scanned copy retained. Idealy id like it to be a one page pdf with a sort of varable init that each times its printed changes to a new unique number.
    – sam
    Commented Dec 13, 2012 at 15:30

2 Answers 2


I separated my answers because they're very different approaches.

Make a script that you can run before you print. How it's structured will really depend on how you want to use it. But if it's a sign-off sheet, I'll run with the assumption that this is one page where you have one text frame that you could update with the unique ID.

Make the text frame and name it by going into the Layers palette and doing a slow double click on the text frame name listed there. Then, find a place to store some data. This could be achieved by an external plaintext or XML file, or you can store within the document if you're only using one document. But if you want to have a format that's signoff-1, signoff-2, signoff-3, then put 1 in that label to start. Have the script pull the value and insert into your text frame, add one to the value, then store the new value. Run the script before you print.

You could generate and place the text frame via scripting as well. You could store multiple values as well to make the convention more complex. So if you had ssanders, djenkins, and dgreen, you could assign a value of 1 to each and then have a script that puts the usernames into a dropdown. You pick the user and then pull their value, so you'd get signoff-djenkins-13.

There's a world of options that open up when you start scripting InDesign!

  • 1
    When I need a short serial number that can accommodate a lot of output (ie, high numeric values) I use javascript to increment through base-36 numbers. Just two b-36 digits (zz) are equivalent to 1295 in decimal. You could go crazy and use three: zzz = 46655 ;) You can see it in action at unitconversion.org if I'm not making sense. Commented Dec 13, 2012 at 19:29
  • Super cool! I want to learn more about this. Is it easy to work with different bases in JavaScript? Do you set it up and then keep your basic i++ in there? Something with toString()?
    – Brendan
    Commented Dec 13, 2012 at 19:39
  • 1
    You tap into the math functions. I think all modern js versions have what you need. i++ can be used, depending on the set up. Unfortunately, I couldn't hammer out the specifics for you. I have a great js developer who usually does all the magic for me: His code is about 10% the length of mine and does more ;) Dig through the js documentation for switching bases in math and you should find what you need. Commented Dec 13, 2012 at 20:03

You might be able to make something work with Text Variables.

Go to Type > Text Variables > Define... and click New.... Name it, select Output Date, and then do something like this:

Edit Text Variable dialog

Then, create a text frame and do Type > Text Variables > Insert Variable to insert.

The idea behind using the date and time is that it will always be different. If the goal is to have a different value every time you print, this will be great because it updates automatically. If you want to name something uniquely and then keep it static (like, have Invoice 001, then Invoice 002), then this would be a bad solution because that date will always be updating until you select it and do Type > Text Variables > Convert Variable to Text.

So you might want to experiment with some of the options in there. You might find something that works for you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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