NPN Posted February 3, 2012 Share Posted February 3, 2012 I have a static document with 44 pages which contain front page, back page, front page, back page .. etc. So 22 two-sided documents. I would like help with a SetBodyPageUsage rule that returns 1 document (two pages) based on field input. So, something like this: if field=1, return page 1+2 if field=2, return page 3+4 if field=3, return page 5+6 The fieldvalue or pagename can be whatever. I've searched the forums, but haven't found an appropriate code to copy. I could code it myself but that would be one hell of a long code so I would appreciate some help :-) Link to comment Share on other sites More sharing options...
step Posted February 3, 2012 Share Posted February 3, 2012 If the field values can be whatever, why not make it the value of the pages you would like to turn on? For example: Field = "1/2" where "1" is the first page and "2" is the second page. And all of your pages are named accordingly. Then your code would look like this: var pages = Field("YourFieldHere"); FusionPro.Composition.SetBodyPageUsage(pages.split("/")[0], true); FusionPro.Composition.SetBodyPageUsage(pages.split("/")[1], true); Link to comment Share on other sites More sharing options...
Dan Korn Posted February 3, 2012 Share Posted February 3, 2012 Step's solution is good, but requires the data to match the page names. I would do this the other way around, basing the page names on the data, something like "1 Front", "1 Back", "2 Front", "2 Back", etc., then the rule will simply look like this: FusionPro.Composition.SetBodyPageUsage(Field("YourFieldName") + " Front", true); FusionPro.Composition.SetBodyPageUsage(Field("YourFieldName") + " Back", true); This will allow you to add more pages based on any arbitrary field data. For instance, if you add a field named "Illinois", you need pages named "Illinois Front" and "Illinois Back". Note also that both my and step's solutions assume that all pages are initially set to unused in the Page Usage dialog. Link to comment Share on other sites More sharing options...
NPN Posted February 27, 2012 Author Share Posted February 27, 2012 Code: FusionPro.Composition.SetBodyPageUsage(Field("YourFieldName") + " Front", true); FusionPro.Composition.SetBodyPageUsage(Field("YourFieldName") + " Back", true); That worked perfectly. Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.