Jump to content

Suppres a page in press


Recommended Posts

Hi

 

I have a business card template, which gets printed on the front of a preprinted sheet.

 

So in the preview on the Marcom Central store I need the user to see the two pages.

But when the product is ordered and Marcom Central creates a press pdf I need to suppress the back.

 

I guess I need to use javascript on the OnRecordStart and name my pages Front and Back.

But what should the javascript be or what should I check for?

 

Kind regards Jimmy Hartington

Link to comment
Share on other sites

Hi again

 

From other threads in the forum I could make this javascript:

//access the "isOnlinePreview" property and the "isPreview" property Text

 

onlinePreviewVal = FusionPro.Composition.JobOptions.isOnlinePreview;

desktopPreviewVal = FusionPro.Composition.isPreview;

 

//turn on/off pages if this is a preview composition or a desktop preview

 

if (onlinePreviewVal == "Yes" || desktopPreviewVal == true)

{

FusionPro.Composition.SetBodyPageUsage("front", true);

FusionPro.Composition.SetBodyPageUsage("back", true);

}

 

else

{

FusionPro.Composition.SetBodyPageUsage("front", true);

FusionPro.Composition.SetBodyPageUsage("back", false);

}

return ""

 

It works as I want to, but is it also the best way to achive this?

Link to comment
Share on other sites

Well, you don't need to set the usage of the front page, just the back page. And there's a helper function IsPreview() in FusionPro 7.1 and later. So this single line should do what you need:

FusionPro.Composition.SetBodyPageUsage("back", IsPreview());

Edited by Dan Korn
typo
Link to comment
Share on other sites

Hi Dan

 

Thanks for your answer.

And sorry for being such a noob at javascript.

But how can I tell in your code that the page is suppressed? I thought there would be some kind of true or false in the code.

I do not quite get the syntax of this code.

 

Kind regards Jimmy

Link to comment
Share on other sites

Hi Dan

 

Thanks for your answer.

And sorry for being such a noob at javascript.

But how can I tell in your code that the page is suppressed? I thought there would be some kind of true or false in the code.

I do not quite get the syntax of this code.

 

Kind regards Jimmy

The second parameter to the SetBodyPageUsage function takes a Boolean (true/false) value. This can certainly be a Boolean literal, i.e. the keywords true or false, but it can also be any expression which evaluates (or can be converted to) a Boolean value. The IsPreview function, as its name suggests, returns a Boolean (true/false) value, and thus it can be used directly in the call to the SetBodyPageUsage function instead of a Boolean literal.

 

You can also do this kind of thing:

FusionPro.Composition.SetBodyPageUsage("back", Field("UseBackPage") == "Yes");

Where the result of the comparison operation using the equality operator == is a Boolean value, by definition.

Edited by Dan Korn
typo
Link to comment
Share on other sites

OK. Now it makes a bit more sense.

 

On the subject of suppressing.

I imagine I could use the same code to suppress a graphic element from the press pdf?

Let's say that I want a red logo saying "PROOF" on the preview, but not on the press pdf.

How should that then be written?

Link to comment
Share on other sites

OK. Now it makes a bit more sense.

 

On the subject of suppressing.

I imagine I could use the same code to suppress a graphic element from the press pdf?

Let's say that I want a red logo saying "PROOF" on the preview, but not on the press pdf.

How should that then be written?

There are lots of examples of doing stuff like that on the forum. The easiest way is just to have a Graphic frame for the logo and populate it or not, based on some condition, in a regular Graphic rule that the Graphic frame calls out, like so:

if (IsPreview())
 return Resource("ProofLogo");
//else
return NullResource();

You can also actually suppress a frame in OnRecordStart if you name it first, like so:

FindGraphicFrame("ProofFrame").suppress = !IsPreview();

But what might be simplest of all is to have a regular old text frame, and a text rule to set some text in it, like so:

if (IsPreview())
 return '<color name=Red><z newsize=72>THIS IS A PROOF!';
//else
return "";

Link to comment
Share on other sites

×
×
  • Create New...