2

Since upgrading to Mavericks, I've noticed that when creating a PDF from another file, such as Pages, the file extension is included in the file name. Is there any way to turn this off?

For example, let's say I create a Pages document called "Proposal.pages". When I'm ready to e-mail the proposal, I'll create a PDF of the document by selecting CMD+P and then "Save as PDF".

The default title that will be chosen is "Proposal.pages.pdf". Fairly simply thing to change, but when you generate PDFs all day, it becomes bothersome.

enter image description here

Does anyone know of a way that I can remove the ".pages" extension when creating the PDF file?

  • I just tried this and I cannot reproduce. What version of OS X are you using? – Alan Shutko Mar 31 '14 at 15:46
  • @AlanShutko the OP is using the "Save as PDF" option in the Print dialog, the name defaults to "document.pages.pdf" there. – nohillside Mar 31 '14 at 15:47
  • 1
    Why do you use the "Save as PDF" option via the Print dialog and not the "Export to ... PDF" menu entry? – nohillside Mar 31 '14 at 15:48
  • 1
    I tried that, but I admit I'm running a beta OS. Just tried it on a bog-standard Mavericks 10.9.2 (in textedit, since pages was not installed there) and it didn't keep the rtf extension. I wonder if LaunchServices db needs to be reset? – Alan Shutko Mar 31 '14 at 16:00
  • Thank you for all the comments! Using the "Export to..." option doesn't include the .pages extension, so that could work. However, I have muscle memory for ⌘P and then ⌘P again to generate the PDF, so I'd still like to find a solution if at all possible. – mashby Mar 31 '14 at 17:40
2

Looks like the "Save as PDF" option in the Print dialog just takes the document title (which is set to the document name by Pages) and adds a .pdf suffix to it. As the new Pages doesn't seem to offer an option to change the title within Pages you might be out of luck here.

Alternatively you could use the "Export to... PDF" menu entry to export to PDF directly.

0

When you click "Save as PDF," you get a window with a top row starting as "Save as." On the right side of that row is a downward pointing arrow. Click on it to expand this window to see all your options. At this point, at the bottom left of the window is a "Hide extension" button.

0

All 3 iWork apps, (Pages, Numbers and KeyNote) neglect to remove their file extension from PDFs when Saving As PDF from the print menu. (Also, the Finder option to show file extensions has to be on.)

It is possible to create a script that deals with this, saving it as a PDF Service, which will be accessible from the PDF button of the print menu. (Any script or app in ~/Library/PDF Services will be shown there. You may need to create this folder.)

This python script will remove the iWork file extension, offer a file dialog, and save the PDF.

#!/usr/bin/python
# coding=utf-8

# SAVE PDF FROM STUPID iWORK  
# PDF Service to strip iWork file extension before saving PDF to designated folder   
# Save this file in ~/Library/PDF Services. It will then be available in the 
# PDF button of the print menu.

import os
import sys
import Quartz as Quartz
from Foundation import NSURL
from AppKit import NSSavePanel, NSApp


def save_dialog(directory, filename):
    panel = NSSavePanel.savePanel()
    panel.setTitle_("Save PDF document")
    myUrl = NSURL.fileURLWithPath_isDirectory_(directory, True)
    panel.setDirectoryURL_(myUrl)
    panel.setNameFieldStringValue_(filename)
    NSApp.activateIgnoringOtherApps_(True)
    ret_value = panel.runModal()
    if ret_value:
        return panel.filename()
    else:
        return ''

def main(argv):
    (title, options, pathToFile) = argv[:]

    # Set the default location where the PDFs will go (you'll need to make sure this exists)

    destination = os.path.expanduser("~/Desktop/")


    stripTitle = (os.path.splitext(title)[0])
    stripTitle += ".pdf"
    outputfile = save_dialog(destination, stripTitle)

    # Copy file to selected location. 
    if outputfile != "":

        pdfURL = NSURL.fileURLWithPath_(pathToFile)
        pdfDoc = Quartz.PDFDocument.alloc().initWithURL_(pdfURL)
        if pdfDoc:
            pdfDoc.writeToFile_(outputfile)

    # Delete original PDF from spool folder
    os.remove(pathToFile)

if __name__ == "__main__":
    main(sys.argv[1:])

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .