Hi,
you have to open each attachment to determine its page count.
Here's a script you can use in a button event.
var that = event.target,
pageCount = 0,
isPDF = 0,
attmt = that.dataObjects,
attmtPath = "",
attmtDoc;
if (attmt !== null) {
for (var i = 0, j = attmt.length; i < j; i += 1) {
if (attmt[i].MIMEType === "application/pdf") {
isPDF += 1;
attmtDoc = that.openDataObject(attmt[i].name);
pageCount += attmtDoc.numPages;
attmtDoc.closeDoc();
}
}
if (isPDF === 0) {
xfa.host.messageBox("There are file attached to this file, but none is a PDF.", "No PDF found", 0, 0);
} else {
xfa.host.messageBox("There " + (isPDF === 1 ? "is ":"are ") + isPDF.toString() + (isPDF === 1 ? " PDF file ":" PDF files ") + "attached to this file.\nThe total page count is: " + pageCount + " pages.", "Page Count of attached PDFs", 0, 0);
}
} else {
xfa.host.messageBox("No files attached to this file.", "No attachments found", 0, 0);
}