Here is an AppleScript drag & drop utility that you can put on your Desktop. Individual Pages documents, or folder(s) of documents can be dropped on this (application), and it will export each document to the original filesystem location with the PDF extension. Since you are using Pages v6.1, this will be PDF Best quality.
- Launchpad : Other : Script Editor
- Copy/paste the following script into your Script Editor
Click the compile button
- Save as AppleScript source
- File menu : Save...
- Name: pages2PDF
- Documents folder
- File Format: Text
- Save
- Option key + File menu : Save As...
- Name: pages2PDF
- Desktop
- File Format: Application
- √ Hide extension
- Save
- Drag & Drop Pages documents on the pages2PDF Desktop application
AppleScript
-- pages2PDF.applescript
--
-- Drag and drop solution where you can drop a file(s), and/or folder(s) of Pages documents
-- and they will all export as PDF in their present filesystem location. If the Pages version
-- is 5.6 or later, export the documents as Best quality.
-- Restriction: Pages v5 or later only
-- Version 1.0, Tested: macOS Sierra 10.12.4, Pages v6.1
-- VikingOSX, 2017-04-07, Apple Support Communities
property pages_kind : {"Pages Publication"}
on opendropped_items
repeat with anItem in dropped_items
try
tell application "Finder" to set akind to kind of anItem
if akind contains "Folder" then
tell application "Finder"
set docList to (every item in entire contents of folder anItem whose kind is in pages_kind) as alias list
end tell
repeat with afile in docList
export_file(afile)
end repeat
else if akind is in pages_kind then
export_file(anItem)
end if
on error errmsg number errnbr
my error_handler(errnbr, errmsg)
tell application "Pages" to if it is running then quit
return
end try
end repeat
end open
return
on export_file(theFile)
tell application "Finder" to set name_ext to name extension of theFile
set exportDocument to text 1 thru ((offset of name_ext in (theFile as text)) - 1) of (theFile as text) & "pdf"
-- Permissions error fix for Sierra < 10.12.4, and Pages v6, v6.0.5
close access (open for accessexportDocument)
tell application "Pages"
try
set mydoc to open theFile
with timeout of 1200 seconds
if (version of it) ≥ "5.6" then
set export_quality to (Best as constant)
exportmydoctofileexportDocumentasPDFwith properties {image quality:export_quality}
else
exportmydoctofileexportDocumentasPDF
end if
end timeout
closemydocsavingno
on error errmsg number errnbr
my error_handler(errnbr, errmsg)
tell application "Pages" to if it is running then quit
return
end try
end tell
tell application "Finder"
if exists (file exportDocument as alias) is true then
set extension hidden of (file exportDocument as alias) to false
end if
end tell
return
end export_file
on error_handler(nbr, msg)
return display alert "[ " & nbr & " ] " & msg as critical giving up after 10
end error_handler