Go Back   MarcomCentral (PTI) and FusionPro User Communities > Software-Related Talk > The JavaScript Library

Notices

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old April 11th, 2022, 04:20 PM
AFitz AFitz is offline
Forum n00b
 
Join Date: Jan 2020
Location: Rock Island, IL
Posts: 7
Default OnRecordStart rule to preview all pages but print only one

I'm hoping you can help me! I have a project where I need to be able to print a label with variable information to be adhered to a booklet we have in inventory. My end users will be ordering this "label" through our MarcomCentral store-front, but I want them to be able to preview the entire booklet at the time the variable label is composed, and then only send the label page to the printer.

So, attached is the collect file. I want the preview to display pages 1-21 and to send page 22 to the printer. (I renamed pages 21 and 22 to "Rep" and "RepLabel" in the collect.) Here's my OnRecordStart rule that I've landed on (I've tried many variations trying to get this to work):

Code:
onlinePreviewVal = FusionPro.Composition.JobOptions.IsOnlinePreview;

if (onlinePreviewVal=="Yes")
{

FusionPro.Composition.SetBodyPageUsage("1", true);
FusionPro.Composition.SetBodyPageUsage("2", true);
FusionPro.Composition.SetBodyPageUsage("3", true);
FusionPro.Composition.SetBodyPageUsage("4", true);
FusionPro.Composition.SetBodyPageUsage("5", true);
FusionPro.Composition.SetBodyPageUsage("6", true);
FusionPro.Composition.SetBodyPageUsage("7", true);
FusionPro.Composition.SetBodyPageUsage("8", true);
FusionPro.Composition.SetBodyPageUsage("9", true);
FusionPro.Composition.SetBodyPageUsage("10", true);
FusionPro.Composition.SetBodyPageUsage("11", true);
FusionPro.Composition.SetBodyPageUsage("12", true);
FusionPro.Composition.SetBodyPageUsage("13", true);
FusionPro.Composition.SetBodyPageUsage("14", true);
FusionPro.Composition.SetBodyPageUsage("15", true);
FusionPro.Composition.SetBodyPageUsage("16", true);
FusionPro.Composition.SetBodyPageUsage("17", true);
FusionPro.Composition.SetBodyPageUsage("18", true);
FusionPro.Composition.SetBodyPageUsage("19", true);
FusionPro.Composition.SetBodyPageUsage("20", true);
FusionPro.Composition.SetBodyPageUsage("Rep", true);

}  

else 

{
 
FusionPro.Composition.SetBodyPageUsage("RepLabel", true);

}
This still isn't resulting in what I want though. Can you help me?

FusionPro Version: VDP Producer 12.1.2
Attached Files
File Type: zip Rep Booklet with Label.zip (3.07 MB, 2 views)
Reply With Quote
  #2  
Old April 12th, 2022, 08:18 AM
jwhittaker jwhittaker is offline
Senior Contributor
 
Join Date: Feb 2009
Location: San Diego
Posts: 169
Default Re: OnRecordStart rule to preview all pages but print only one

Afritz,
You need to make all your pages unused and then change your OnRecordStart rule to this:

//access the "isOnlinePreview" property and the "isPreview" property Graphic
onlinePreviewVal = FusionPro.Composition.JobOptions.IsOnlinePreview;

if (onlinePreviewVal=="Yes")
{
for (i=1; i<=20; i++)
{
FusionPro.Composition.SetBodyPageUsage(i, true);
}
FusionPro.Composition.SetBodyPageUsage("Rep", true);
}
else
{
FusionPro.Composition.SetBodyPageUsage("RepLabel", true);
}

Jon
__________________
FusionPro VDP Creator 10.0.26 | MacOS 10.13.4 | Acrobat DC
Reply With Quote
  #3  
Old May 2nd, 2022, 01:32 PM
AFitz AFitz is offline
Forum n00b
 
Join Date: Jan 2020
Location: Rock Island, IL
Posts: 7
Default Re: OnRecordStart rule to preview all pages but print only one

Thanks, Jon! And sorry for the delayed response, I didn't get notified that you responded.
Unfortunately, that still only resulted in the label page being previewed within the Marcom Admin tool. See revised collect attached. Did I miss something else?

Amber

Booklet with Label_Preview and Print.zip
Reply With Quote
  #4  
Old May 5th, 2022, 02:10 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,671
Default Re: OnRecordStart rule to preview all pages but print only one

I think the problem is on the first line of your rule:
Code:
onlinePreviewVal = FusionPro.Composition.JobOptions.IsOnlinePreview;
It should be:
Code:
onlinePreviewVal = FusionPro.Composition.JobOptions.isOnlinePreview;
Note the lower-case "i" at the start of the property name isOnlinePreview.

Or better yet, remove that line completely and make the next line this:
Code:
if (IsOnlinePreview())
While CFG settings are case-insensitive, JavaScript properties, such as of the FusionPro.Composition.JobOptions object, are named case-sensitively, so upper-case vs. lower-case is significant.

Calling the built-in global function IsOnlinePreview() instead is better, as it insulates you from having to know the internals of the CFG file and its settings and values.
__________________
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
  #5  
Old May 16th, 2022, 10:53 AM
AFitz AFitz is offline
Forum n00b
 
Join Date: Jan 2020
Location: Rock Island, IL
Posts: 7
Default Re: OnRecordStart rule to preview all pages but print only one

Awesome!! That worked! Thank you so much! This is going to make a lot of people very happy...
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 08:01 AM.


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