Pages not showing extensions when exported to PDF

I changed my files so that Preview would open all PDFs rather than Adobe Acrobat. That works fine. But now when I export a PDF from Apple Pages the extension is hidden. I had done quite a bit of exporting from Pages to PDFs before I changed the default app for opening PDFs to Preview and the extension always was visible. I can't see a way to change that back without resetting all PDFs to be opened by Acrobat (which I dislike a lot).

MacBook Pro (Retina, 15-inch, Mid 2015), Mac OS X (10.5.5)

Posted on Jun 5, 2016 8:26 AM

Reply
10 replies

Aug 3, 2016 7:08 AM in response to Bruce Kieffer

Agreed. However, Apple has not fixed this issue in 3 years, so hope is fading... . You could choose the Provide Pages Feedback menu item from the Pages menu, and you would join a very long list of others.


I have an AppleScript that tells Pages v5 to automatically export the PDF, and then tells Finder to unhide the PDF extension. I too got tired of the inherent nonsense.

Aug 3, 2016 9:35 AM in response to Bruce Kieffer

Of course.


Copy/paste the following AppleScript into your Script Editor (launchpad : Other : Script Editor). Click the hammer icon to compile it (multi-color code). When you click the black arrow button to run it, there will be a prompt to choose your file (Pages or Word), and it will be written back to the same location with a PDF extension.


I would save the Script once as AppleScript source (plain text) using File Format: Text. Then option+Save As with File Format: your choice of script, script bundle, or application) to your Desktop.


Code:


-- PDFbest.applescript

-- Export Pages v5.6, v5.6.1, or later document as PDF Best

-- v1.2, added support for selection of Word documents

-- VikingOSX, Jan. 2016, Apple Support Community

use scripting additions


-- Allow selection of all Pages, and MS Word document formats

property valid_document : {"com.apple.iwork.pages.sffpages", "com.apple.iwork.pages.pages", "org.openxmlformats.wordprocessingml.document", "com.microsoft.word.doc"}

property default_loc : ((path to desktop) as text) as alias


try

set theFile to (choose fileof typevalid_documentwith prompt "Choose a Pages or Word document:" showing package contentsnodefault locationdefault_loc without invisibles)


if result = {button returned:"Cancel"} then error number -128

on error errmsgnumbererrnbr

my error_handler(errnbr, errmsg)

return

end try


tell application "System Events"

set pf_info to package folder of theFile as boolean

set name_ext to name extension of theFile

end tell


-- use original document path and name, but change extension

if false is in pf_info then

if name_ext contains "pages" then

set exportDocument to text 1 thru -6 of (theFile as text) & "pdf"

else if name_ext contains "docx" then

set exportDocument to text 1 thru -5 of (theFile as text) & "pdf"

else if name_ext contains "doc" then

set exportDocument to text 1 thru -4 of (theFile as text) & "pdf"

end if

else

-- Pages package folders name extension ends in ':'

set exportDocument to text 1 thru -7 of (theFile as text) & "pdf"

end if


tell application "Pages"


activate

try

with timeout of 1200 seconds

set mydoc to open theFile

exportmydoctofileexportDocumentasPDFwith properties {image quality:Best}

end timeout

closemydocsavingno

on error errmsg number errnbr

my error_handler(errnbr, errmsg)

tell application "Pages" to if it is running then quit

end try

end tell


tell application "Finder"

if existsfileexportDocument then

set extension hidden of (file exportDocument as alias) to false

-- reveal (file exportDocument as alias)

end if

end tell

return


on error_handler(nbr, msg)

return display alert "[ " & nbr & " ] " & msg as critical giving up after 10

end error_handler

Aug 5, 2016 5:10 AM in response to VikingOSX

The batch script is working for interactive mixtures of files and folders containing Pages and Word documents. Drag and drop of a folder containing these files works too.


Drag and drop of individual mixed files and a folder processes one file, and the folder contents, with some other misadventure that I am still debugging, and there was at least one new anomaly introduced by Pages v5.6.2 and/or 10.11.6 that I have resolved (I think).

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Pages not showing extensions when exported to PDF

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.