Home
 
The page you are viewing is part of our 160,000 page PDF discussion forum archive spanning 1999-2011.
Go to the new Planet PDF forum to join the PDF community.
 

Search
 Advanced   
Sign up for a WebBoard account Archive Forum Home


PLATINUM
SPONSOR


Topic  
Go to previous topicPrev TopicGo to next topicNext Topic
Author Message
ronnroz
ronnroz

Total Messages 2

Subject:Auto Number while printing.

Hello All,

I have this situation, I will try to explain and hopefully you guys can help me out.

I am printing event tickets. So I created this PDF file (11 x17) which has 8 tickets. I would like to auto number each ticket by 1 increment when printed. I should be able to specify the starting number, though.
If I need 800 tickets, that means I will have to print 100 copies of that document, but each ticket should have a number incremented by 1. Also for each ticket, the number should be printed on 2 places. Which means one 11x17 sheet would have 16 nos. or 8 set of numbers.

Can anyone please help me with this situation? Any help would be greatly appreciated.

Please keep in mind I have no experience in Java Scripting, so if you should suggest a Java Script, please be kind enough to give me specific instructions along with it.

Thank you all in advance.

Ronnie


Posted: 19 Aug 2005 09:18 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
gkaiseril
gkaiseril

Total Messages 3000

Subject:Auto Number while printing.

You need to create 8 pairs\ of identically named fields.

For example the fields are named "SequenceNumber.0" thru "SequenceNumber.7"

You then to create a print button with the property of "visible but does not print", and insert the following script into the "Run a JavaScript" for the "Mouse Up" action. Which will print groups of 8 tickets until the nubmer of tickets inputted to the response prompt is reached.

// ---> start code
var TicketsPerPage = 8; // tickets per page
// get number of tickets to print
var PrintNumber = app.response({cTitle: "Number to Print", cQuestion: "Enter number of tickets to print:", cDefault: 1, cLabel: "Number:"});
// print the tickets
var i = 0; // counter for tickets printed
// loop while the counter "i" is less than the number of tickets to print
do {
// number next group of tickets until ticket limit reached
for (j = 0; (j < TicketsPerPage & i+j < PrintNumber); j++) {
console.println(j + " " + (i + j + 1));
this.getField("SequenceNumber."+j).value = i + j + 1;
} // end for j
// void ticket stubs not printed
for (k = j; k < TicketsPerPage; k++) this.getField("SequenceNumber."+k).value = "VOID";
// increment tickets printed by 8 tickets printed
i = i + j;
// print page of tickets
app.alert("Insert page to print");
this.print();
// clear the form
this.resetForm("SequenceNumber");
} while (i < PrintNumber);
// ---> end code



DocumentRaffleTickets.pdf
Raffle Tickets example

Posted: 19 Aug 2005 01:27 PM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
theocat
theocat

Total Messages 2

Subject:Auto Number while printing.

Hello All,

I have this situation, I will try to explain and hopefully you guys can help me out.

I am printing a lots of forms .
So I created a PDF file (8!/2x11) which has 2 FORMS UP.
I would like to auto number each form by 1 increment when printed.
The starting number it will for example 000001
If I need 1000 forms , that means I will have to print 500 copies of that document, but each form should have a number incremented by 1(000001, 000002, 000003, .......).

Can anyone please help me with this situation? Any help would be greatly appreciated.

Please keep in mind I have no experience in Java Scripting, so if you should suggest a Java Script, please be kind enough to give me specific instructions along with it.

Thank you all in advance.

Theodoros


Posted: 25 Aug 2005 01:50 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
theocat
theocat

Total Messages 2

Subject:Auto Number while printing.

Hello All,

I have this situation, I will try to explain and hopefully you guys can help me out.

I am printing a lots of forms .
So I created a PDF file (8!/2x11) which has 2 FORMS UP.
I would like to auto number each form by 1 increment when printed.
The starting number it will for example 000001
If I need 1000 forms , that means I will have to print 500 copies of that document, but each form should have a number incremented by 1(000001, 000002, 000003, .......).

Can anyone please help me with this situation? Any help would be greatly appreciated.

Please keep in mind I have no experience in Java Scripting, so if you should suggest a Java Script, please be kind enough to give me specific instructions along with it.

Thank you all in advance.

Theodoros


Posted: 25 Aug 2005 01:50 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
gkaiseril
gkaiseril

Total Messages 3000

Subject:Auto Number while printing.

Using the script I provided above:

1. Change the value for "TicketsPerPage" form 8 to 2
2. Change the line that reads "this.getField("SequenceNumber."+j).value = i + j + 1;"
to "his.getField("SequenceNumber."+j).value = util.printf("%,106d", i + j + 1);"
3. Comment out the "app.alert" line to allow continuous printing

More information on the "printf" method is contained in Adobe's Adobe PDF Scripting Reference Material.


Posted: 25 Aug 2005 03:18 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
Azrael72
Azrael72

Total Messages 7

Subject:Auto Number while printing.

I have the exact same situation as above, only I am printing 4 tickets pet page and only need one ticket number per ticket.

I am very new to this. Do I take my pdf with the tickets and make it into a form to add the fields or do I simply add text fields to the form???

Thanks

Chris


Posted: 12 Sep 2005 06:48 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
Azrael72
Azrael72

Total Messages 7

Subject:Auto Number while printing.

I have the exact same situation as above, only I am printing 4 tickets pet page and only need one ticket number per ticket.

I am very new to this. Do I take my pdf with the tickets and make it into a form to add the fields or do I simply add text fields to the form???

Thanks

Chris


Posted: 12 Sep 2005 07:27 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
Azrael72
Azrael72

Total Messages 7

Subject:Auto Number while printing.

Ok....I have performed the following:

Imported my pdf into a form.

Created text fields named as above.

Created Print button, set attributes

Pasted the following Java:

// ---> start code
var TicketsPerPage = 4; // tickets per page
// get number of tickets to print
var PrintNumber = app.response({cTitle: "Number to Print", cQuestion: "Enter number of tickets to print:", cDefault: 1, cLabel: "Number:"});
// print the tickets
var i = 0; // counter for tickets printed
// loop while the counter "i" is less than the number of tickets to print
do {
// number next group of tickets until ticket limit reached
for (j = 0; (j < TicketsPerPage & i+j < PrintNumber); j++) {
console.println(j + " " + (i + j + 1));
this.getField("SequenceNumber."+j).value = util.printf("%,106d", i + j + 1)
} // end for j
// void ticket stubs not printed
for (k = j; k < TicketsPerPage; k++) this.getField("SequenceNumber."+k).value = "VOID";
// increment tickets printed by 8 tickets printed
i = i + j;
// print page of tickets
//app."Insert page to print");
this.print();
// clear the form
this.resetForm("SequenceNumber");
} while (i < PrintNumber);
// ---> end code

Print button will print 1 page, regardless of how many tickets I enter (ie 8 = 2 printed pages) and the numbers are not populating.

What am I missing?

Thx

C


Posted: 12 Sep 2005 07:40 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
gkaiseril
gkaiseril

Total Messages 3000

Subject:Auto Number while printing.

I tried your code and it worked fine for me. I am attaching the form with your code and I added some code to display the console and print some information about the processing which should help locate the error. I am using Acrobat version 6.0.4.



DocumentTickets.pdf
Tickets

Posted: 12 Sep 2005 10:57 AM
Originally Posted: 12 Sep 2005 10:48 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
Azrael72
Azrael72

Total Messages 7

Subject:Auto Number while printing.

Interesting....

Ok....could it be my fields are set up incorrectly?

I just added 4 text fields, labled SequenceNumber.x per under the binding tab and pretty much left everything else default.

I also tried the fields as numberic.

I am using Designer 7.0


Posted: 13 Sep 2005 05:48 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
gkaiseril
gkaiseril

Total Messages 3000

Subject:Auto Number while printing.

The problem is, the solution I provided uses the older AcroForms and it can not be used by Designer without of changes. You have to use the Forms feature in a plain PDF, not created by Designer, to access the form tool and form field features. Acrobat 7 supports both Designer or AcroForms in a PDF, but not both at the same time.


Posted: 13 Sep 2005 06:32 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
Azrael72
Azrael72

Total Messages 7

Subject:Auto Number while printing.

coolbeans....

I got it working. Thank a ton. This is going to save a lot of time. I dont have as much to print as these other guys, but we are printing high quality, color tickets and, while my printer does a fantastic job, it takes a lot of time per page.

One last question....

I would like the numbers to be formatted in a #0xx type fashion (#001, #075, etc). Is this doable?

Thanks again. I dig learning new stuff. Up to this point the only thing I have done with acrobat is view files.

C


Posted: 13 Sep 2005 08:10 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
gkaiseril
gkaiseril

Total Messages 3000

Subject:Auto Number while printing.

You need to modify:

this.getField("SequenceNumber."+j).value = util.printf("%,106d", i + j + 1):

to add the octaphone, "#":

this.getField("SequenceNumber."+j).value = "#" + util.printf("%,106d", i + j + 1);:

and then set the print width to 3 characters:

this.getField("SequenceNumber."+j).value = "#" + util.printf("%,103d", i + j + 1);:

More information about the "util.printf()" is contained in the Acrobat JavaScripit Scripting Reference available for fee download from Acrobat SDK documentation - JavaScirpt.


Posted: 13 Sep 2005 11:09 AM
Originally Posted: 13 Sep 2005 11:06 AM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
Azrael72
Azrael72

Total Messages 7

Subject:Auto Number while printing.

ok...now I just feel like I am being a pest.

I made the change. Here is what I have:

// ---> start code
var TicketsPerPage = 4; // tickets per page
// get number of tickets to print
var PrintNumber = app.response({cTitle: "Number to Print", cQuestion: "Enter number of tickets to print:", cDefault: 1, cLabel: "Number:"});
// print the tickets
var i = 0; // counter for tickets printed
// loop while the counter "i" is less than the number of tickets to print
do {
// number next group of tickets until ticket limit reached
for (j = 0; (j < TicketsPerPage & i+j < PrintNumber); j++) {
console.println(j + " " + (i + j + 1));
this.getField("SequenceNumber."+j).value = "#" + util.printf("%103d", i + j + 1);:
} // end for j
// void ticket stubs not printed
for (k = j; k < TicketsPerPage; k++) this.getField("SequenceNumber."+k).value = "VOID";
// increment tickets printed by 8 tickets printed
i = i + j;
// print page of tickets
//app."Insert page to print");
this.print();
// clear the form
this.resetForm("SequenceNumber");
} while (i < PrintNumber);
// ---> end code

After making the change and clicking OK on the JavaScript editor, I get an error bonk and a Syntax message : syntax error 12:(null) at line 13.

Line 13 is the next line after the edited line: } // end for j

If I delete this line, I get the same error, same line number.

????


Posted: 13 Sep 2005 12:28 PM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
gkaiseril
gkaiseril

Total Messages 3000

Subject:Auto Number while printing.

The line that reads:

this.getField("SequenceNumber."+j).value = "#" + util.printf("%103d", i + j + 1);:

should read

this.getField("SequenceNumber."+j).value = "#" + util.printf("%103d", i + j + 1);

You need to remove the colon.


Posted: 13 Sep 2005 12:55 PM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
Azrael72
Azrael72

Total Messages 7

Subject:Auto Number while printing.

DOH!

That did it....looks like this is working as hoped!

You rock...thank you so much!

C


Posted: 13 Sep 2005 01:52 PM
Left Button SpacerView user's profile profileRight Button Spacer
 
 
   
Go to previous topicPrev TopicGo to next topicNext Topic

go




Top | News | Developer | Find PDF Tools | Sponsorship | Tips | Home



Debenu's Planet PDF - a comprehensive site exclusively focused on Adobe Acrobat/PDF users and uses. Debenu's Planet PDF - Resources for Adobe Acrobat and PDF users

Please post PDF-related questions to our Planet PDF Forum forums.planetpdf.com. To send comments about this site please visit our contact page.
Planet PDF, Planet PDF Forum, PDF SDK - Debenu Quick PDF Library and Debenu are all copyright
2011 Debenu Pty Ltd.. All Rights Reserved. Privacy policy.