Skip to main content
Participant
Oct 7, 2016 10:06 PM UTC
Answered

I want to create a billing invoice number in acrobat field each time I open a pdf. How can I do that?

This is the area that I want the numbers. Each time I open the pdf document create a different billing number. I think that the code is in Javascript but I don't know.

I'm going to use 10 digits. Where I place the code?

Thanks for your help.

This topic is closed to new replies. Start a new post to keep the conversation going.
try67
try67Correct answer
Community Expert
Oct 9, 2016 9:11 AM UTC

Go to Tools - JavaScript - Document JavaScripts, create there a new item called "scripts", and then paste this code into the window that opens:

this.getField("WORK ORDER").value = util.printf("%010d", (Number(this.getField("WORK ORDER").value) + 1));

9 replies

Participant
Oct 10, 2016 2:04 PM UTC

Thanks try67​ for your support. I appreciate that.  Thumbs up

Translate
Participant
Oct 9, 2016 8:47 PM UTC

Another ? try67​. I test it and works fine. when I open the document, I need save it first before complete all the information or save as like a new document?

Thks

Translate
try67
Community Expert
Community Expert
Oct 9, 2016 8:52 PM UTC

Not sure what you mean... If you want the document to automatically save when you open it (after the invoice number is changed, I assume) then that is possible, but it requires installing a script on the local machine.

Translate
Participant
Oct 9, 2016 1:35 AM UTC

Example. 00000001 (Secuencial)

Translate
try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
Oct 9, 2016 9:11 AM UTC

Go to Tools - JavaScript - Document JavaScripts, create there a new item called "scripts", and then paste this code into the window that opens:

this.getField("WORK ORDER").value = util.printf("%010d", (Number(this.getField("WORK ORDER").value) + 1));

Translate
Participant
Oct 9, 2016 5:15 PM UTC

Works great!!!!!! Thanks try67​

Translate
try67
Community Expert
Community Expert
Oct 8, 2016 7:42 AM UTC

Do you want it to be a random number, or a sequential one?

Translate
Participant
Jan 11, 2018 5:20 PM UTC

What code can I use to have sequential numbers beginning with a specific number like 2018-IN-20000, next number being 2018-IN-20001? Thank for any help.

Translate
Participant
Jan 11, 2018 5:25 PM UTC

instead of "WORK ORDER" for the field id its "DOCKET NO" thanks

Translate