Jump to content

Multi-page repeating number sequence


scottws

Recommended Posts

1.85" x 6" tickets, 5000 run imposed 20 per 19" x 13" sheet. Run would be 250 imposed sheets.

5 different tickets, numbering on the front.

 

Fronts would be:

 

#1 red

#3 green

#5 cyan

#7 blue

#9 black

 

#3 red

#5 green

#7 cyan

#9 blue

#11 black

etc.

 

and then numbers ascending, using the same sequence of backgrounds

 

Attachment represents top sheet of press run.

Where do I start to configure a rule to advance the numbers as per sample?

Link to comment
Share on other sites

The way I would do this is set up a graphic frame as the background for the ticket and name it "Background." Then I would set up two text frames, 1 for the page number and 1 for the sequence number, calling them "PageNumber" and "Seq" respectively. And assign the values/content to each of those frames via the OnRecordStart Callback rule.

 

I was unsure if you're populating your the ticket number (i.e. the "Seq" text frame in this scenario) from a 5000 record data file or if you weren't using a data file at all and were just repeating a record 5000 times. I wrote this code assuming it was the former:

var page = [["1","Red"],["3","Green"],["5","Cyan"],["7","Blue"],["9","Black"]]; // Page Number and associated background color
var ticketsPerPage = 1000; // 1-1000
var numberOfPages = page.length; // 1, 3, 5, 7, 9
var seq = FusionPro.Composition.inputRecordNumber;

var pageNum = "Page " + page[Math.floor(seq / (ticketsPerPage + 1 / numberOfPages))][0];
var color = page[Math.floor(seq / (ticketsPerPage + 1 / numberOfPages))][1];

FindTextFrame("PageNumber").content = pageNum;
FindTextFrame("Seq").content = seq;
FindGraphicFrame("Background").fillColorName = color;

 

I created an array called "page" containing the value for the page number and the background color associated with that page number. As the code runs, the position of the array changes based on the record number (record 1001 advances to the second position of the array, etc).

 

Of course if you'd rather just have 5 background images that already said "Page x" on them you could simplify the code to this:

var page = ["1","3","5","7","9"]; // Page Number and associated background color
var ticketsPerPage = 1000;// 1-1000
var numberOfPages = page.length; // 1, 3, 5, 7, 9
var seq = FusionPro.Composition.inputRecordNumber;

var background = page[Math.floor(seq / (ticketsPerPage + 1 / numberOfPages))] + ".pdf"; 

FindTextFrame("Seq").content = seq;
FindGraphicFrame("Background").SetGraphic("path/to/graphics/" + background); // Assuming your files are called "1.pdf", "3.pdf", etc

 

And lastly, if you are repeating 1 record 5000 times rather than 5000 records 1 time, you'll need to replace "FusionPro.Composition.inputRecordNumber" with "FusionPro.Composition.repeatRecordNumber".

Link to comment
Share on other sites

Sound like you want to pull in different backgrounds every 1000 records like I mentioned here:

Of course if you'd rather just have 5 background images that already said "Page x" on them you could simplify the code to this:

var page = ["1","3","5","7","9"]; // Page Number and associated background color
var ticketsPerPage = 1000;// 1-1000
var numberOfPages = page.length; // 1, 3, 5, 7, 9
var seq = FusionPro.Composition.inputRecordNumber;

var background = page[Math.floor(seq / (ticketsPerPage + 1 / numberOfPages))] + ".pdf"; 

FindTextFrame("Seq").content = seq;
FindGraphicFrame("Background").SetGraphic("path/to/graphics/" + background); // Assuming your files are called "1.pdf", "3.pdf", etc

 

You can add the file name's of those backgrounds to the array and modify the code to look like this:

// File names for your 5 fronts
var page = [
   "background1.pdf",
   "background2.pdf",
   "background3.pdf",
   "background4.pdf",
   "background5.pdf"
   ]; 

var ticketsPerPage = 1000;// 1-1000
var numberOfPages = page.length;
var seq = FusionPro.Composition.inputRecordNumber;

var background = page[Math.floor(seq / (ticketsPerPage + 1 / numberOfPages))]; 

FindTextFrame("Seq").content = seq;
FindGraphicFrame("Background").SetGraphic("path/to/graphics/" + background);

Link to comment
Share on other sites

<< And assign the values/content to each of those frames via the OnRecordStart Callback rule.>> I'm really at a loss doing this. I see there are online training modules. Which ones would address this type of coding situation? We have several variations of number schemes I need to generate.
Link to comment
Share on other sites

This is where the values are assigned to the frame:

FindTextFrame("Seq").content = seq;

 

Is your text frame named "Seq"? Did you put the code in the OnRecordStart Callback? What do you mean by "several variations of number schemes?" I'm starting to feel like I don't have enough information about what you're trying to do to help you. Can you collect your job, sample data, and post it to this thread with a better explanation so that I, or someone else, can get a better idea?

Link to comment
Share on other sites

Some days I have 40-50 ticket jobs to do. It seemed that I could save my pdf and use as a master, with all the rules and data in place, it would speed things up. I could just import the data from one file to the next.

Also, I have to do an OnJobStart rule to place the bleed on the background page, since I apparently can't do a bust-cut with bleed. Re-using a file saves me recreating the background page every time. I saw no way to import a template page from one file to another.

Edited by scottws
clarity
Link to comment
Share on other sites

Some days I have 40-50 ticket jobs to do. It seemed that I could save my pdf and use as a master, with all the rules and data in place, it would speed things up. I could just import the data from one file to the next.

Also, I have to do an OnJobStart rule to place the bleed on the background page, since I apparently can't do a bust-cut with bleed. Re-using a file saves me recreating the background page every time. I saw no way to import a template page from one file to another.

 

When you define your data you can use the option of "Import a data source from another document". Load the .def file from your template. Then once that is done go to FusionPro on the toolbar go to advanced and import. Select your template PDF. You will now have all your rules, resources, text boxes, etc.

Link to comment
Share on other sites

I would just have pages 1 and 2 as blank pages and use graphic switches based on the data to pull the different versions of art. This is not the speedy solution you are looking for, but I can't write JavaScript like some others here. Ste seems to have an idea on how to do it though.
Link to comment
Share on other sites

I would just have pages 1 and 2 as blank pages and use graphic switches based on the data to pull the different versions of art.

 

Yes, this is what I suggested and even posted code to accomplish this. Not sure how else to help. Good luck!

Link to comment
Share on other sites

As I said before, the rule needs to go in an OnRecordStart Callback rule. Not an OnJobStart callback rule. And if you didn't build your quantities into your data, which it appears that you have not, you need to modify the code as I stated in my first post:

And lastly, if you are repeating 1 record 5000 times rather than 5000 records 1 time, you'll need to replace "FusionPro.Composition.inputRecordNumber" with "FusionPro.Composition.repeatRecordNumber".

 

So the OnRecordStart code would look like this:

var page = [
   "1.pdf",
   "2.pdf",
   "3.pdf"
   ]; 

var ticketsPerPage = 48;
var numberOfPages = page.length;
FusionPro.Composition.repeatRecordCount = ticketsPerPage;
var seq = FusionPro.Composition.repeatRecordNumber;

var background = page[Math.floor(seq / (ticketsPerPage + 1 / numberOfPages))]; 

FindTextFrame("Seq").content = seq;
FindGraphicFrame("front").SetGraphic("/Users/sackett/Desktop/FP12-12/" + background);

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...