Show new serial number in pdf everytime it opens?


I have a pdf-dokument that I would like to put a serialnumber in...e.g. in the upper right corner.
Every time someone opens the pdf document a new number should come up. the first time anyone open it the number should be 1...then 2...3...4...and so on.

How can I accomplish this?
Who is Participating?
Karl Heinz KremerCommented:
In this case, you can use a database to keep track of the serial number:

Adobe created ADBC, which is their JavaScript interface to ODBC. This allows you to create a JavaScript routine that can update a table in a database (e.g. in your case the last serial number used). You need to run this routine at the time the user clicks on the submit button (or, saves the document). Do you have any experience with JavaScript in general, or Acrobat's JavaScript implementation? Have you looked at the AcroJS guide that's available from Adobe's web site yet?
Karl Heinz KremerCommented:
That is almost impossible to do.
Will all your users use the full version of Acrobat? Will all of them be connected to the Interent when they open the PDF for the first time? If you can answer "Yes" to both of these questions, then you have a small chance that you can make it work.

What you need is a server that hands out serial numbers. These numbers can e.g. be requested by SOAP. SOAP however is something that only works with the full version of Acrobat.

Would the serial number be stored in the file after it's opened for the first time? If so, you need to force a write operation - potentially against the user's will (which is generally not a good thing to do).

Why do you need to add a serial number when the document is opened? In my opinion, it would make more sense to assign a serial number before the file gets distributed, so that you can keep track of it. That's something that is relatively easy to do with a tool that can stamp the pages of a PDF before you e.g. deliver it via the web browser.
tombombadilllAuthor Commented:
Ok, som the best way to do this is to create the pdf with e.g. PHP (pdflib) and there write out the pdf with a new serial number every time...

I think the pdf will be in a shared folder on a LAN and every time somebody open the file it should get a new serial number. The serialnumber can be stored where ever its best... =)

All the users will not have Adobe Acrobat installed...

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Karl Heinz KremerCommented:
With just the free Reader as client application, this is impossible to do.

You don't have to create the PDF from scratch every time it's opened, just take a "normal" PDF, and then use a tool that can stamp existing pages. I am not familiar with any PHP tools to manipulate PDF files, but I'm pretty sure that you can find a tool that fits your needs an your budget.

Again, why do you want to do that? Do you want to track how often the file is opened, or do you want to track different "versions" of the document (even though the actual document is still the same, but the serial number is different)? If you can describe the reason why you need to do this, we may be able to offer a better way of accomplishing that goal.
tombombadilllAuthor Commented:
Ok, a stamp tool seems to be the solution? Any suggestions which?

I don't really know why but I think it is because they want to open the pdf, fill it with text and then save it and then it has a unique number.
Karl Heinz KremerCommented:
OK, let's take a step back: You cannot save a PDF with Reader. You can "reader enable" PDFs with (expensive) server tools from Adobe, or by using a 3rd party service (e.g., but your standard PDFs will not be saved in Reader after you fill in form fields. If that is a requirement, you need to look for a different tool set. All that Reader can do is to submit the filled form to a server. You could assign the serial number on the server once the filled form is received, and then send back the complete form with the serial number to the client. This way, the client can print the form with the serial number.

To stamp a PDF, you can either write your own based on a library like iText ( or it's .NET version at Or, you can buy a solution. There are too many packages out there, and what you need depends on what environment you are running in. Take a look at teh PDFStore ( I've used Appligent's Stamp PDF Batch a few years ago, but I don't know if they've updated their software since then - the Acrobat plug-in Stamp PDF has definitely not been updated for a few years.

tombombadilllAuthor Commented:
Ok, now I have checked how this will be used. All the users will have Adobe Acrobat installed so they will be able to save the pdf with fill in form fields.

...and when the user fills the form fields with data and then SAVE the pdf the serial number should be increased with 1. If you open it and don't save it...the serial number shouldn't be increased.

The environment will be windows and the pdf will be on a shared directory on a server.

Hope this make it easier for you to help me. :)
tombombadilllAuthor Commented:
Ok...good! :)

Do you have any links to where I can read more about this?

I have a lot of experience in JS but not with ADBC... Have not looked at the AcroJS guide but will do that.
Karl Heinz KremerCommented:
YOu can find the Acrobat JavaScript Scripting Reference -(that's the AcroJS document from above) and the Acrobat JavaScript Scripting Guide here:

That's all the documentation that's available.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.