(* Copy/paste into Script Editor, and save as Text (e.g. pages2PDF.applescript). Then, option+Save As… and save as Application to the Desktop (pages2PDF.app). Drag and drop one or multiple Pages documents or a folder containing Pages documents onto the application, and the PDF will be written to the same location as the original. Quit the Script Editor Pages2PDF.applescript Requires Pages v5.6 or later thru Pages 13.2 (tested) Tested: macOS 10.14.6, 10.15.4, 14.1.1 VikingOSX, 2023-11-10, Apple Support Communities, No warranties expressed or implied *) use scripting additions property valid_kind : {"Pages Publication", "Pages document"} property fileCnt : (0 as integer) property app_icon : "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MultipleItemsIcon.icns" on open dropped_items tell application "Pages" to set aversion to its version considering numeric strings if aversion < "5.6" then display alert "You need Pages v5.6 or later to run this script" giving up after 10 quit end if end considering repeat with anItem in the dropped_items try tell application "Finder" set akind to kind of anItem if akind is equal to "Folder" then set docList to (every item in entire contents of folder anItem ¬ whose kind is in valid_kind) as alias list repeat with afile in docList my export_file(afile) end repeat else if akind is in valid_kind then my export_file(anItem) else log "ignore" # not a folder or pages document end if end tell on error errmsg number errnbr set errval to "Dropped Items repeat - " & (anItem as text) my error_handler(errval, errnbr, errmsg) quit end try end repeat tell application "System Events" if fileCnt > 0 then display dialog "Export Complete." & return & tab & " Files exported to PDF " & " : " & (fileCnt as text) ¬ buttons {"Done"} default button "Done" with title "Pages Export Facility" with icon POSIX file app_icon as alias else display dialog "Export completed without any files processed." & return & "Only Pages (.pages) documents are exported to PDF." buttons {"Done"} default button "Done" with title "Pages Export Facility" with icon POSIX file app_icon as alias end if end tell quit end open on export_file(afile) -- switch extension from .pages to .pdf set {TID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ".pages"} set exportDocument to item 1 of text items of (afile as alias as text) & ".pdf" set AppleScript's text item delimiters to TID close access (open for access exportDocument) tell application "Pages" try set myDoc to open afile with timeout of 1800 seconds if (version of it) ≥ "5.6" then export myDoc to file exportDocument as PDF with properties {image quality:Best} else export myDoc to file exportDocument as PDF end if end timeout set fileCnt to (fileCnt + 1) as integer close myDoc saving no on error errmsg number errnbr my error_handler("Export file", errnbr, errmsg) quit end try end tell -- force extension visibility on exported PDF tell application "Finder" if exists (item exportDocument as alias) then set extension hidden of (item exportDocument as alias) to false end if end tell return end export_file on error_handler(nbr, msg, handler_name) return display alert handler_name & ": " & "[ " & nbr & " ] " & msg as critical giving up after 10 end error_handler on quit {} -- perform these cleanup items, and then really quit tell application "Pages" to if it is running then quit set fileCnt to (0 as integer) set exportDocument to "" continue quit end quit