How do I find the total number of pages of a PDF file?

Dear Sergiossoares,

in order to have the total pages of a PDF you must do it in a script like this:

var PDFpath = ‘images/testprint.pdf’

var Totpages = resource(PDFpath).pages;

this will grab the pdf name testprint.pdf located in the images resources of the Template and store the value into the variable PDFpath, Totpages will store the amount of pages there in the PDF.