Jump to content

SetBodyPageUsage return two pages


NPN

Recommended Posts

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

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

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

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