Jump to content

Page Count Rule


dfalkowitz

Recommended Posts

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!

Link to comment
Share on other sites

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";

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...