Jump to content

Access page number within a rule


havdp

Recommended Posts

Is there a way to access the current page number within a rule. I've found "FusionProResource.pagenumber" but can't find any documentation on how to use it. It appears to be used with external resources, though. I need to access the current page number in the control document.
Link to comment
Share on other sites

Is there a way to access the current page number within a rule.

No. With the exception of a few specialized Callback rules, rules are evaluated on a per-record basis, not on a per-page or per-frame basis. So there really isn't a way to access the page number from a rule.

 

That said, if I knew what you were trying to accomplish, I might be able to suggest another approach.

I've found "FusionProResource.pagenumber" but can't find any documentation on how to use it. It appears to be used with external resources, though.

Right. That's for specifying a page number from a multi-page graphic resource (such as a PDF) to use in a graphic copyhole. It's not relevant to the composed output page number.

Link to comment
Share on other sites

I was attempting to write a rule that would calculate data for a barcode that drives our stitcher. Outside the trim on the last page of each sheet we print a barcode that tells the stitcher which sheet it is out of the total number of sheets.

 

For example, on a 12-page saddle stitch booklet, we would print a barcode outside the trim on pages 8, 10, and 12 which tells the stitcher they are sheets 1 of 3, 2 of 3, and 3 of 3, respectively. If I could access the page number, I could write a rule such as:

 

var pages = 12;

return ((pagenumber-(pages/2))/2) + ' of ' + (pages/4);

 

on page 8:

(8-(12/2))/2 = (8-6)/2 = 2/2 = "1 of " (12/4) = "3"

 

This would prevent me accidentally typing in the wrong data within the barcode which I can't read without a scanner.

Link to comment
Share on other sites

I was attempting to write a rule that would calculate data for a barcode that drives our stitcher. Outside the trim on the last page of each sheet we print a barcode that tells the stitcher which sheet it is out of the total number of sheets.

 

For example, on a 12-page saddle stitch booklet, we would print a barcode outside the trim on pages 8, 10, and 12 which tells the stitcher they are sheets 1 of 3, 2 of 3, and 3 of 3, respectively.

I see. Well, you'll need three separate text frames on different pages to accomplish this anyway, so I'm not sure having one rule saves you that much.

If I could access the page number, I could write a rule such as:

 

var pages = 12;

return ((pagenumber-(pages/2))/2) + ' of ' + (pages/4);

 

on page 8:

(8-(12/2))/2 = (8-6)/2 = 2/2 = "1 of " (12/4) = "3"

 

This would prevent me accidentally typing in the wrong data within the barcode which I can't read without a scanner.

I'm not sure what you mean about typing in the wrong data. You should be able to hard-code the "1 of 3" or whatever on each page. If the issue is that you're trying to type that text in a barcode font, just create a rule to output an <f name=xxx> tag for the barcode font, and insert that before your text in the frame, and then you can type in a readable font.

Link to comment
Share on other sites

I hadn't thought about using a font tag. That's a good idea.

 

If all my booklets were only 12 pages, hard coding wouldn't be such an issue. What I do now is copy and paste the text box on each page, then change the font to a human readable font, edit the text, and change the font back to the barcode font. That's a lot of work on an 80-page booklet. If I had a rule, I could just copy and paste without editing.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...