Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > FusionPro® VDP Server (API)

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old February 5th, 2016, 12:28 PM
MarkJonesEMKT MarkJonesEMKT is offline
Junior Community Member
 
Join Date: Dec 2015
Location: Virgina
Posts: 17
Default Imposition Stack Count

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:
Code:
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

Code:
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?
Reply With Quote
  #2  
Old February 5th, 2016, 12:55 PM
Dan Korn's Avatar
Dan Korn Dan Korn is offline
FusionPro Senior Engineer / Forum Moderator
 
Join Date: Aug 2008
Location: Chicago, IL
Posts: 4,320
Default Re: Imposition Stack Count

I'm not understanding the problem. FusionPro will calculate the number of stacks for you. What exactly is the output you want, and what is the actual output you're getting, and how precisely are they different?
__________________
Dan Korn
FusionPro Developer / JavaScript Guru / Forum Moderator
PTI Marketing Technologies | Printable | MarcomCentral
LinkedIn

I am a not a Support engineer, and this forum is not a substitute for Support. My participation on this forum is primarily as a fellow user (and a forum moderator). I am happy to provide help and answers to questions when I can; however, there is no guarantee that I, or anyone else on this forum, will be able to answer all questions or fix any problems. If I ask for files to clarify an issue, I might not be able to look at them personally. I am not able to answer private messages, emails, or phone calls unless they go through proper Support channels. Please direct any sales or pricing questions to your salesperson or inquiries@marcom.com.

Complex template-building questions, as well as all installation and font questions or problems, should be directed to FusionProSupport@marcom.com. Paid consulting work may be required to fulfill your template-building needs.

This is a publicly viewable forum. Please DO NOT post fonts, or other proprietary content, to this forum. Also, please DO NOT post any "live" data with real names, addresses, or any other personal, private, or confidential data.

Please include the specific versions of FusionPro, Acrobat, and your operating system in any problem reports or help requests. I recommend putting this information in your forum signature. Please also check your composition log (.msg) file for relevant error or warning messages.

Please post questions specific to the MarcomCentral Enterprise and Web-to-Print applications in the MarcomCentral forum. Click here to request access. Or contact your Business Relationship Manager (BRM/CPM) for assistance.

Please direct any questions specific to EFI's Digital StoreFront (DSF) to EFI support.

How To Ask Questions The Smart Way

The correct spellings are JavaScript, FusionPro, and MarcomCentral (each with two capital letters and no spaces). Acceptable abbreviations are JS, FP, and MC (or MCC). There is no "S" at the end of "Expression" or "Printable"! The name of the product is FusionPro, not "Fusion". "Java" is not is not the same as JavaScript.

Check out the JavaScript Guide and JavaScript Reference! FusionPro 8.0 and newer use JavaScript 1.7. Older versions use JavaScript 1.5.

return "KbwbTdsjqu!spdlt\"".replace(/./g,function(w){return String.fromCharCode(w.charCodeAt()-1)});
Reply With Quote
  #3  
Old February 5th, 2016, 01:07 PM
MarkJonesEMKT MarkJonesEMKT is offline
Junior Community Member
 
Join Date: Dec 2015
Location: Virgina
Posts: 17
Default Re: Imposition Stack Count

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.
Reply With Quote
  #4  
Old February 5th, 2016, 01:45 PM
step's Avatar
step step is offline
Senior Contributor
 
Join Date: Jan 2010
Location: Charlotte, NC
Posts: 955
Default Re: Imposition Stack Count

As I noted in this thread (despite the last post crediting Dan 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
Code:
// 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:
Code:
var chunkSize = FusionPro.Composition.JobOptions["RecordsPerChunk"];
var stack= chunkSize/impo ;
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);
}
__________________
Ste Pennell
FusionPro VDP Creator 9.3.15
Adobe Acrobat X 10.1.1
Mac OS X 10.12

LinkedIn
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 06:37 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) 2011, PTI Marketing Technologies™, Inc.