2022.2

Table Of Contents
// File does not exist
}
resource(location, pageNumber)
location
ThelocationshouldbeaURLrelativetothetemplaterootoranabsolutefile-basedURL(withoutpro-
tocol),e.g."C:/myfile.pdf".
pageNumber(optional)
Thedesiredpage.Countingstartsat1.Ifnopagenumberisgiven,informationaboutthefirstpagewill
beretrieved.
ThereturnedobjectisofthetypeImageInfo.Ithasthefollowingfields:
Field Type Description
height
float Theheightofthecurrentpage(inpoints).
page
Number Currentpagenumber(countingfrom1)withintheresource.
pages
Number Thetotalnumberofpagesintheresource.
permissions
"Permissions"onthenextpage PDFonly.AllowstoverifyifaPDFispassword-protectedorhasrestrictionsforprinting.
width
float Thewidthofthecurrentpage(inpoints)
Examples
ThisscriptretrievesthesecondpageofaPDFthatispresentinthetemplate'sresources.
var pdf = resource("images/stamp.pdf", 2);
var height = pdf.height;
var width = pdf.width;
var numberOfPages = pdf.pages;
Inthefollowingscript,thefunctionisusedtocheckifafileexists.
if(resource("C:/paw.pdf")){
//exists
} else {
//oops
}
Page 821