Jump to content

Another way to read page number?


Recommended Posts

For many years we have used a different software for personalized images. That software creates the images and creates an appended data list, such that the name of each unique image is in a new field named "Field1", "Field2", "Field3", etc. I bring that appended data into a simple template that I use to keep an updated contact sheet. Each page consists of 8 picture and text frames using the rules below:


Text frame rule called label1:


return (((FusionPro.Composition.currentPageNumber-1) * 8) + 1)


Graphic frame rule called graphic1:


var pic = CreateResource(".//images//" + Field("Field" + Rule("label1")), "graphic", true)

return pic


Theses rules are duplicated 7 more times and customized for each position.


This works great. As I get more images, I duplicate as many pages as necessary, and it keeps bringing in the appropriate images and labels. Right now, I am up to 134 images.


Now we are using FP Expression. So I thought I could continue with a similar style by using this rule:


var ResourceName = Rule("label1"); 
var Field1 = "First"; 

var myPI = Resource(ResourceName);
myPI.AddData(UntaggedRuleOrField(Field1) || " ");

return myPI;


and then name my FP Expression resources beginning at 135 to pick up where the other images ended.


This is not working, because the call to create the Expression images happens before composition, so it is not bringing the composition page number into the label rule calculation, thus resulting in not being able to find resource 0, resource -1, resource -2, etc.


Is there an alternative way to read the template body page number so it can be calculated up front?



Link to comment
Share on other sites

Sure, check the "Re-evaluate this rule for every graphic frame" box on the Rule Editor, and you can use the property FusionPro.Composition.currentPageNumber in the rule.


Though, instead of having to manually add pages to the template whenever there's a new resource, you could just repeat the record with a single page with one graphic and text frame on it, and use imposition to place an arbitrary number of those pages on each output sheet.

Link to comment
Share on other sites

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.

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