Here’s a modified script for Pages:
-- Convert Pages documents to PDF
property extensionList : {"pages"}
tell application id "DNtp"
set theSelection to the selection
set theFolder to path to trash as string
repeat with theRecord in theSelection
set thePath to (path of theRecord) as POSIX file
set theFile to thePath as alias
tell application "Finder"
set ext to name extension of theFile
if ext is in extensionList then
set theName to name of theFile
set theFilename to characters 1 through ((length of theName) - (length of ext) - 1) of theName as string
set theFilename to theFilename & ".pdf"
set theConvertedPath to (theFolder & theFilename as string)
tell application "Pages"
set theDoc to open theFile
export theDoc as PDF to file theConvertedPath
close theDoc
end tell
tell application id "DNtp" to import POSIX path of theConvertedPath to (parent 1 of theRecord)
end if
end tell
end repeat
end tell