Jump to content

Variable Pages


INGuser

Recommended Posts

Good Morning,

 

I am wondering if there is a way to insert a specific number of pages behind my cover page with out adding 492 template pages and writing a rule for each page usage. I have attached my collected files.

 

I have a cover page that will include Dept #, Dept Name, Qty and Box number. I want to insert a static PDF page behind the Cover page as many times as what is listed in the Qty filed in the data file. So if my Qty is 492 I want 492 static PDF pages entered behind my Cover sheet. I have also attached a sample file of what I am looking for my output to look like.

 

Thank you in advance for your assistance.

Cover sheets-test.zip

Link to comment
Share on other sites

You could try something like this in a Callback Rule.

 

OnRecordStart:

FusionPro.Composition.repeatRecordCount = Field("[color="Red"]Quantity[/color]");
FusionPro.Composition.SetBodyPageUsage(1, FusionPro.Composition.repeatRecordNumber == 1);

 

Or more specific to your template:

FusionPro.Composition.repeatRecordCount = Field("[color="Red"]COUNTS [/color]");
FusionPro.Composition.SetBodyPageUsage(1, FusionPro.Composition.repeatRecordNumber == 1);

 

More info can be found here. But Ste provided an excellent description of what is happening below.

Edited by David Miller
Link to comment
Share on other sites

You can do this by repeating each record by the quantity in an OnRecordStart rule. So if the quantity in the data is 492, FP will repeat the record 492 times. This is set with "FusionPro.Composition.repeatRecordCount".

 

In addition to that, you want to set the 1st page in your template (your cover page) to only display on the initial run of the repetition. FusionPro keeps track of where it is in the 'repeat' process and allows you to access that information through "FusionPro.Composition.repeatRecordNumber." So you'll only want to display the cover page when the 'repeatRecordNumber' is equal to 1. Like this:

var qty = StringToNumber(Field("COUNTS "));
FusionPro.Composition.repeatRecordCount = qty;
FusionPro.Composition.SetBodyPageUsage(1, (FusionPro.Composition.repeatRecordNumber == 1));

Link to comment
Share on other sites

Thank you. Both responses worked great. Just one other question that i did not think to add in the original post. Is there a way to use an impostion template with these rules. When I try to use the one that I have setup for simplex 8.5x11 to print two up on a 12x18 sheet it keeps giving me an error that reads "The number of pages in this record does not match the imposition signature: 1 blank pages will be added.

A body page does not have master page assigned." Any ideas?

Link to comment
Share on other sites

That's because technically the first time through the repeat, you'll have two pages (cover and static) and every other repeat is just the static page. You'll just need to repeat the record by the quantity + 1 (for the cover) and set the page usage so that the each repeat is only producing 1 page:

var qty = StringToNumber(Field("COUNTS "));
FusionPro.Composition.repeatRecordCount = qty + 1; // Plus 1 for cover
FusionPro.Composition.SetBodyPageUsage(1, (FusionPro.Composition.repeatRecordNumber == 1));
FusionPro.Composition.SetBodyPageUsage(2, (FusionPro.Composition.repeatRecordNumber != 1));

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...