Jump to content

Imposition Stack Count


Recommended Posts

Hello All,

 

I am trying to create a bunch of templates that I can have others at my company pull in and not have to edit any actual code. I don't actually know if this is possible or not, but what I would like to do is be able to read the imposition stack size from OnRecordStart.

 

I have been having some issues getting the imposition settings to work with a slipsheet the way I want. We impose in stacks first and then across or wherever else. I know that I can get the chunk size from the FP Globals and I have been using that to name my files, but I was hoping that I could get the stack size for the imposition as well. Here is what I have so far for a 2 Up imposition.

 

In OnRecordCount:

var chunkSize = FusionPro.Composition.JobOptions["RecordsPerChunk"];
var stack= chunkSize/2 ;
if(cover = FusionPro.Composition.inputRecordNumber % stack == 1)
   FusionPro.Composition.repeatRecordCount = 2;

var page = (cover && FusionPro.Composition.repeatRecordNumber == 1) ? 'SetSheet' : 'Page1';
FusionPro.Composition.SetBodyPageUsage(page,true);
}

and in a rule that will label which stack is which

 

var stackSize = FusionPro.Composition.JobOptions["RecordsPerChunk"] / 2;
var beginstack = FusionPro.Composition.inputRecordNumber;
var setnumb = 0;
setnumb = Math.ceil(beginstack/stackSize);
return "Set # " + setnumb;

 

What I would like to be able to do is replace the variable stack with the count of the imposition. That way I wouldn't have to tailor the rule based on the composition and I could simply create 1 template for each size of paper rather than a template for the size of paper and number of stacks that will be printed. Is there a way to do this?

Link to comment
Share on other sites

The output that I want is a set sheet that will have a design and the stack number (i.e 1, 2, etc) on top of the corresponding stacks. Say I am using stacks of 300 on a 2 up imposition. The first sheet left side will say stack 1, the right side will say stack 2 and the left side will contain records 1-300 in a stack and the rightside will contain records 301-600.

 

The program that I have now currently does this just fine. I was wondering if it would be possible to not have to hard code the number of stacks that I will be using. So if I wanted to run a 4up imposition, I would not have to change the numbers to 4up in the code. Because my code currently determines if a new stack is beginning, it would be extremely simple if I was able to know how many records where in each stack without having foreknowledge of the imposition. So if somebody were to increase the stack size or change it from a 2 up imposition to a 4 or 6 up imposition, I wouldn't have to modify any code to get the set sheets in the right place.

Link to comment
Share on other sites

As I noted in this thread (despite the last post crediting Dan :eek: haha), there's a hacky way to do what you're trying to do. You can get the imposition file from the cfg file (JobOptions) and load it up as an external data file at the start of the job. Once you've loaded it, parse out the values for the three imposition columns and multiply them together and assign it to a global variable:

OnJobStart

// Get the name of the FPI file from the cfg file
var fpiFile = FusionPro.Composition.JobOptions["ImpositionDefFileName"];

// Import the .fpi file as an external data file delimited by returns (\n)
var ex = new ExternalDataFileEx(fpiFile,'\n');

// Print Error if the template can't link to the fpi file
if(!ex.valid) Print('* Failed to link to the FPI file in OnJobStart. Assuming 1 up *');

// Create an object with the 'Repeat' properties on the fpi document
var fpi = {};
for (var i=0; i<=ex.recordCount; i++){
   var [prop,val] = ex.GetFieldValue(i,0).split("=");
   if (/Repeat/.test(prop)) fpi[prop] = val;
}

// Get the values of the 3 columns in the imposition setting and put them in "array"
var array = [];
['Primary', 'Secondary', 'Tertiary'].forEach(function(s){
   array.push([ fpi[s + 'RepeatDirection'], fpi[s + 'RepeatCount']]); });

// Remove the "Stack" Column and "None" Column
// Assign the Vertical & Horizontal values to vert & hor (default to 1)
var [vert,hor] = array.filter(function(m){ 
   return (m[0] != "Stack" && m[0] != "None");
   }).map(function(s){ return Int(s[1]) || 1; });

// Multiply horizontal and vertical counts to determine imposition 
impo = vert*hor;

 

Then your code could be modified to:

var chunkSize = FusionPro.Composition.JobOptions["RecordsPerChunk"];
var stack= chunkSize/[color="Red"]impo[/color] ;
if(cover = FusionPro.Composition.inputRecordNumber % stack == 1)
   FusionPro.Composition.repeatRecordCount = 2;

var page = (cover && FusionPro.Composition.repeatRecordNumber == 1) ? 'SetSheet' : 'Page1';
FusionPro.Composition.SetBodyPageUsage(page,true);
}

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