Skip to main content
Known Participant
May 8, 2020
Question

Please I need help to generate new serial numbers on a form during each print

  • May 8, 2020
  • 2 replies
  • 4546 views

Please and please i need help getting my following attached adobe form on my PC to generate new sequential serial numbers on the specified "Ticket Number" field on the form during each print. I print lots of copies of this template, during the production, i want the form to be able to generate serial numbers on the specific field just like the illustration attached. say i send 1,000 copies of the form to print, the numbers should be generated accordingly till the last copy.

Please i will appreciate any support to this request. Thanks

This topic has been closed for replies.

2 replies

Participating Frequently
May 12, 2020

Deoptic,
Maybe you could print locally first by selecting a pdf printer (such as doc.printerName = "Adobe PDF"), which quickly generates a pdf for you. Then print this pdf (flat) on the industrial printer. Printing on paper should be fast.

Tip: rearrange your code with Thomp's correction.

try67
Community Expert
Community Expert
May 12, 2020

Not that quickly, as you'll need to manually enter the name for each file...

Participating Frequently
May 12, 2020


hi try67,
but I understand that you can send silently to the printer to avoid asking for the file name.
Returning to the Thomp correction:
var start = 1;
var doc = this.getPrintParams ();
doc.interactive = doc.constants.interactionLevel.silent;
doc.printerName = "Adobe PDF";
doc.bUI = false;
doc.bSilent = true;

for (var nSheets = 0; nSheets <10; nSheets ++)
{
   for (var i = 1; i <= 12; i ++)
      this.getField ("Ticket_No_" + i) .value = util.printf ("% 04d", start ++);
      this.print (doc);
}

Before, "Adobe PDF" printer can be configured to indicate the path and not open the printed pdf.
With several printed pdfs you can use binder.

try67
Community Expert
Community Expert
May 8, 2020

Doing that requires using a script, and you can't use the Copies field in the Print dialog because that only prints identical copies of the file, so each print needs to be in a separate command.

Known Participant
May 8, 2020

Ok, thank you try67,

are you saying it can only work like the following?

try67
Community Expert
Community Expert
May 10, 2020

Hello, guys am still not sure of how to go about this, I am confused, please i help here. can someone please help me out, i really need this now, this is what i did, 

and i did it with this scripts:

var f = this.getField("Ticket_No_1");
if (f.value=="") f.value = "0001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_2");
if (f.value=="") f.value = "0001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_3");
if (f.value=="") f.value = "1001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_4");
if (f.value=="") f.value = "1001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_5");
if (f.value=="") f.value = "2001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_6");
if (f.value=="") f.value = "2001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_7");
if (f.value=="") f.value = "3001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_8");
if (f.value=="") f.value = "3001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_9");
if (f.value=="") f.value = "4001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_10");
if (f.value=="") f.value = "4001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_11");
if (f.value=="") f.value = "5001";
else f.value = util.printf("%04d", (Number(f.value)+1));

var f = this.getField("Ticket_No_12");
if (f.value=="") f.value = "5001";
else f.value = util.printf("%04d", (Number(f.value)+1));

 

but when i send to print, like i sent print 10 copies of this very page from the same acrobat page, it all came back the same, all 10 copies the same, not changing the numbers serially as i expected,

 

while in the real sense, what i want to achieve is to be able to send this singular page to print:

and it will print the first page as above and subsequent page with the increasing numbers until the end of the sent number of copies like the following:

please i need help to get this done, i will really appreciate help here, thanks.

 

 


Again, you can't us the Copies field of the Print dialog to do it. You need to do it using a script that both sets the fields and prints the file in a loop.