PDA

View Full Version : Javascript Rule to suppress pages at preview


rsager
September 30th, 2011, 08:22 AM
We have a calendar that we would like the customer to preview the first 14 pages and have the last 14 pages, pages 15-28 to be use as the printer pages. Is there a Javascript rule that will let us do this?

Dan Korn
September 30th, 2011, 09:02 AM
I'm not sure what you mean by "preview" in this context. In FP Desktop, all body pages are previewed. If you mean that you only want to compose a subset of pages, that's done by naming pages and calling the FusionPro.Composition.SetBodyPageUsage function in OnRecordStart. Search this forum or the Rules Guide for SetBodyPageUsage for more information.

Also, instead of painstakingly lining up 30 or so frames on multiple pages, you could write a JavaScript rule to dynamically generate tables for the calendar months, with logic such as this (http://forums.pti.com/showthread.php?p=4206#post4206). You could reuse the logic and compose the job for different years without having to redo the whole thing each year.

rsager
September 30th, 2011, 12:02 PM
We are trying to create an 11 X 17 two sided saddle stitch calendar. There does not seem to be an easy way to do this in FrusionPro. We would like the first 14 pages to be previewed in MarcomCentral the way the end user will see it. The last 14 pages are the printer spreads. Preview Body 1-14, Compose Body 15-28.
There may be an easier way to do this the end result should be pages 15-28.

The calendar needs to print with the January's photo on top of the bottom half of page 14. January's calendar would print with the top half of page 14. February's photo would print with December's calendar. February's calendar would print with December's photo. March's photo would print with November's calendar. March's calendar would print with November's photo. April's photo would print with October's calendar. April's calendar would print with October photo. May's photo would print with September's calendar. May's calendar would print with September's photo. June's photo would print with August's calendar. June's calendar would print with August's photo. July's photo would print with July's calendar as it appears.

I hope this makes sense.
Thanks for your help.

Dan Korn
September 30th, 2011, 01:02 PM
in MarcomCentral
Ah, this was the context that was missing. Please ask questions specific to MarcomCentral in the MarcomCentral forum (http://forums.printable.com/forumdisplay.php?f=15).

That said, to do saddle stitch output in FusionPro, you don't need to have two whole different sets of pages, one with the "regular" layout and one with the saddle-stitch order. You just need to use FusionPro's built-in imposition capabilities. There's a "Saddled Stitched" option on the Layout tab in FP Imposer which does this. Then you can just check or uncheck the first box on the Imposition tab of the Composition Settings dialog to switch between the two modes. In fact, I believe that MarcomCentral does this automatically, and shows the un-imposed pages (the "end user" view) for preview, but composes using imposition (i.e. the "printer spreads") for press output. But that can be clarified on the MCC forum.

rsager
October 3rd, 2011, 10:35 AM
Dan,
Thanks for replying to my post.
The way the output pages need to be arranged we can not set this up using a simple Tumble Duplex or Saddle stitch option in FusionPro Imposer. I was told by support that it could be done as a OnRecordStart Callback rule, very much like hiding pages with the word “Proof” on them. I am trying to do this on my own without any success.

Dan Korn
October 3rd, 2011, 11:01 AM
The way the output pages need to be arranged we can not set this up using a simple Tumble Duplex or Saddle stitch option in FusionPro Imposer.
Why not? What exactly do you need to do that FP Imposer can't handle? Did you try using FP Imposer? Did you try right-clicking on the pictures of the pages in the upper right pane and selecting one of the "Rotate" options?
I was told by support that it could be done as a OnRecordStart Callback rule, very much like hiding pages with the word “Proof” on them. I am trying to do this on my own without any success.
Yes, as I said before, you need first need to name all your pages in the Page Usage dialog, then conditionally call the FusionPro.Composition.SetBodyPageUsage function for each page in OnRecordStart. But, as I also said before, exactly how to determine whether MarcomCentral is doing an online preview, in your rule, is something you need to ask about in the MarcomCentral forum (http://forums.printable.com/forumdisplay.php?f=15).

Dan Korn
October 3rd, 2011, 02:38 PM
Yes, as I said before, you need first need to name all your pages in the Page Usage dialog, then conditionally call the FusionPro.Composition.SetBodyPageUsage function for each page in OnRecordStart. But, as I also said before, exactly how to determine whether MarcomCentral is doing an online preview, in your rule, is something you need to ask about in the MarcomCentral forum (http://forums.printable.com/forumdisplay.php?f=15).
It turns out that the thing to switch off of in a MarcomCentral composition is the IsOnlinePreview() function. Therefore your OnRecordStart rule could look something like this:
for (var pageNum = 1; pageNum <= 14; PageNum++)
FusionPro.Composition.SetBodyPageUsage("Preview " + PageNum, IsOnlinePreview());
for (var pageNum = 1; pageNum <= 14; PageNum++)
FusionPro.Composition.SetBodyPageUsage("Press " + PageNum, !IsOnlinePreview());
Where you've gone into the Page Usage dialog and named all of your pages "Preview 1", "Preview 2", etc., and "Press 1", "Press 2", etc.

Although I still don't see why this can't all be done with FP Imposer.

rsager
October 4th, 2011, 05:26 AM
I wil try this. I attached the PDF that is produced by MarcomCentral. When we print the file out duplexed tumble January's photo is in the correct but it is matched up with February's Calendar. January's calendar ends up on the last page. The next page we end up with March's Photo matched with April's calendar and so on. Thanks for taking the time to help me out with this.

sgillesp
October 1st, 2015, 09:15 AM
In this situation, I would love to see an option built into MarcomCentral, template area, viewer options to allow the preview image to be rotated. This would be helpful, as the admin who isn't building the template or designing the product, but just wants our end user to be able to read the preview and approve it before ordering it.

Dan Korn
October 1st, 2015, 09:37 AM
In this situation, I would love to see an option built into MarcomCentral, template area, viewer options to allow the preview image to be rotated. This would be helpful, as the admin who isn't building the template or designing the product, but just wants our end user to be able to read the preview and approve it before ordering it.
Bug reports and enhancement suggestions for the MarcomCentral product should be directed to your BRM, or at least posted in the MarcomCentral app forum (http://forums.pti.com/forumdisplay.php?f=15).

That said, there's no reason why you can't switch off of the IsOnlinePreview() function in OnRecordStart to conditionally call out different pages. You can even use the GetBodyPage and FindTextFrame and FindGraphicFrame functions to resize and move pages and frames in the online composition.

And again, you can use imposition to have the final "press" composition laid out differently than the preview.

jwhittaker
October 1st, 2015, 12:36 PM
rsager
Try setting all your pages to unused and name them 1,2,3,etc.
The code below will turn on pages when you are doing an online or desktop preview and will turn the other pages on when you compose online or on the desktop.

then add this code to the onrecord start rule

onlinePreviewVal = FusionPro.Composition.JobOptions.isOnlinePreview;
desktopPreviewVal = FusionPro.Composition.isPreview;

if (onlinePreviewVal == "Yes" || desktopPreviewVal == true)
{
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);
}
else
{
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("21", true);
}

Dan Korn
October 1st, 2015, 12:49 PM
rsager
Try setting all your pages to unused and name them 1,2,3,etc.
The code below will turn on pages when you are doing an online or desktop preview and will turn the other pages on when you compose online or on the desktop.

then add this code to the onrecord start rule

onlinePreviewVal = FusionPro.Composition.JobOptions.isOnlinePreview;
desktopPreviewVal = FusionPro.Composition.isPreview;

if (onlinePreviewVal == "Yes" || desktopPreviewVal == true)
{
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);
}
else
{
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("21", true);
}
Okay, except that you don't need to name all the pages like that; you can just reference the pages by number. And you don't need to mark them all unused to start with if you just modify the rule slightly to pass something other than hard-code true or false. Also, a simple for loop will reduce the amount of code that you need to copy-and-paste. And you can use the built-in functions IsOnlinePreview() and IsDesktopPreview(), or just IsPreview() to cover both cases. So the rule can be simply this:
for (var i = 1; i <= 7; i++)
FusionPro.Composition.SetBodyPageUsage(i, IsPreview());
for (var i = 15; i <= 21; i++)
FusionPro.Composition.SetBodyPageUsage(i, !IsPreview());