Jump to content

OnRecordStart rule to preview all pages but print only one


AFitz

Recommended Posts

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

 

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

Rep Booklet with Label.zip

Link to comment
Share on other sites

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

Link to comment
Share on other sites

  • 3 weeks later...

I think the problem is on the first line of your rule:

onlinePreviewVal = FusionPro.Composition.JobOptions.IsOnlinePreview;

It should be:

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:

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.

Link to comment
Share on other sites

  • 2 weeks later...

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