PDA

View Full Version : Page Count Rule


dfalkowitz
March 16th, 2012, 04:55 AM
Is there a way to create a rule based on the page count?

For example:
if pagecount > 1
return "Continued on next page"

I know you can insert $pagecount into a text box but don't know how to add $pagecount into a rule.

Thanks!

Stack
March 22nd, 2012, 10:37 AM
BUMP!

I'm trying to utilize $pagecount in a rule too, without luck...

dfalkowitz
March 22nd, 2012, 10:46 AM
I was told by PTI, that you can not add it to rule, but this is something they are trying to develop it in a future release.

ThomasLewis
March 22nd, 2012, 03:41 PM
I have the following working just fine.

var r = Resource("File.pdf");

if (r.countPages > 2)
{
FusionPro.Composition.SetBodyPageUsage("page3", true);
}

Stack
March 23rd, 2012, 09:48 AM
I have the following working just fine.

var r = Resource("File.pdf");

if (r.countPages > 2)
{
FusionPro.Composition.SetBodyPageUsage("page3", true);
}


I was able to adapt this code for my project and it works great, thanks!!!

Just to explain my project, it's a booklet product in which a user uploads a PDF and overflow pages are automatically added. But I want to limit the user to a maximum of 48 pages. So working off that code, if a user uploads a PDF greater than 48 pages, it'll hide my Body and Overflow pages and activate my "Warning" page, which instructs the user to upload a PDF with no more than 48 pages.

dfalkowitz - Assuming your project similarly involves somebody uploading a PDF file, you should be able to setup a rule like this, replacing File Upload with your field:


var r = new FusionProResource(Field("File Upload"), "graphic", "true");

if (r.countPages > 1)
return "Continued on next page";

dfalkowitz
March 24th, 2012, 06:58 AM
Thanks for the input!!!