getlastpage('myPDF.pdf') && Call the function
Procedure getlastpage(PDFDoc)
Local oAcrobatExch
oAcrobatExch = Createobject("AcroExch.PDDoc") &&Instanciate
oAcrobatExch.Open(PDFDoc) && Open the document
lnPagenum = oAcrobatExch.GetNumPages() && Get the last page number
oAcrobatExch.Close() && Close the application
Release oAcrobatExch
Return lnPageNum
Endproc