Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Batch convert to pdf

Is there a way to batch convert several single page, Pages documents to individual pdfs or a multi-page pdf?
Thanks.

MacPro 2.66 24" LED Display, Mac OS X (10.6.6), 12 G RAM, MBP 17"/2.8 core 2 duo, 10.6.5, 8 G RAM, Canon 5D, 50D, G11

Posted on Feb 5, 2011 8:56 AM

Reply
16 replies

Aug 26, 2017 6:04 AM in response to qwedcxza0

Why pay for a Pages export tool, when you can get one here for free that does the same thing?


I have written, and shared said tool with the Pages for Mac community multiple times — a drag & drop AppleScript solution that batch exports single, multiple, or folders of Pages documents to your choice of PDF, or Word (.doc/x) formats. It even gives you a choice of writing the exported documents to a separate output folder.


I will post it here again, if you request it (and you are running OS X 10.10 or later).

Aug 26, 2017 6:50 AM in response to qwedcxza0

  1. Launchpad : Other : Script Editor
  2. Copy/paste the entire contents of the following scrollable window into Script Editor

    Click Compile, but not Run.

  3. Save
    1. AppleScript source
      1. File menu : Save...
      2. Save As: pages_export
      3. Tags: optional
      4. Desktop or your choice
      5. File Format: Text
      6. Hide Extension is unchecked, and then Save
    2. Application
      1. Option key + File menu : Save As...
      2. Save As: pages_export
      3. Tags: optional
      4. Desktop
      5. File Format: Application (no options are selected)
      6. √ Hide extension, and Save
  4. Quit Script Editor


Drag and drop a single/multiple Pages '06 - '09, v5, v6 document(s), or folder containing them, onto the application icon on the desktop. You will be prompted to choose the export format, and then if you want the exported documents written to the original document location, or to a separate folder.


It is a necessary annoyance that the batch conversion process will open Pages for each document, and keep it on screen as long as it takes to export. When all exports are done, a dialog is presented with the processed file count. PDF documents will be exported Best quality if using Pages v5.6 or later.


-- pages_export.applescript -- -- Usage: Drag & Drop Pages document(s), and/or folder(s) containing them. -- Recursively processes folder contents, and exported files written to specified -- folder (default), or to original file location with new extension. -- Export supported and tested: PDF, docx, and doc. -- Export to USB stick tested successfully. -- To be saved as AppleScript Application -- Version: 2.0 -- Tested: OS X El Capitan 10.11.6, macOS Sierra 10.12.5 -- 3x faster on El Capitan with same version of AppleScript -- Require: OS X 10.10 or later. Pages v5.5.3 or later. Application will check. -- VikingOSX, 2017-06-30, Apple Support Communities property ca : current application property fmsg : "Choose or Create Export Folder:" property fdefault : (path to desktop) as alias property export_choices : {"PDF", "DOCX", "DOC"} property msg : "Choose Pages Export Format:" & return & "DOCX (default - return):" property exportFormat : "" property expFolder : "" property valid_kind : {"Pages Publication", "Pages document"} property fileCnt : (0 as integer) property app_icon : "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MultipleItemsIcon.icns" use framework "Foundation" use AppleScript version "2.4" -- Yosemite 10.10 or later use scripting additions on run -- only if the user double-clicks the application icon display alert "Drag and Drop Pages documents and/or folder(s) of Pages documents" & return & ¬ "onto the application icon. Make your export choice from the export type selection." quit end run on open dropped_items tell application "Finder" to set sys_version to version considering numeric strings if sys_version < "10.10" then display alert ¬ "You need OS X Yosemite 10.10 or later to run this script." giving up after 10 quit end if end considering tell application "Pages" to set aversion to version of it considering numeric strings if aversion < "5.5.3" then display alert "You need Pages v5.5.3 or later to run this script" giving up after 10 quit end if end considering try set choice to text returned of (display dialog ¬ "Exported files to separate folder (Y/N)?" default answer "Y") if {"Y", "y"} contains choice then repeat while true set expFolder to (choose folder with prompt fmsg default location fdefault ¬ without invisibles, multiple selections allowed and showing package contents) if not expFolder is equal to fdefault then exit repeat end repeat end if set exportFormat to (choose from list export_choices with prompt msg ¬ default items {"DOCX"} multiple selections allowed false ¬ with empty selection allowed) if exportFormat is false then error number -128 -- user cancelled set exportFormat to lowercase (item 1 of exportFormat) on error errmsg number errnbr my error_handler("dropped items prep", errnbr, errmsg) quit end try 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) 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 display dialog "Export Complete." & return & tab & " Files exported to " & ¬ exportFormat & " : " & (fileCnt as text) ¬ buttons {"Done"} default button "Done" with title "Pages Export Facility" with icon POSIX file app_icon as alias quit end open on export_file(theFile) try set exportDocument to new_extension(theFile, exportFormat, 0) as POSIX file if not expFolder = "" then -- because Finder can't get name of non-existent file at this point set basename to new_extension(theFile, exportFormat, 1) as text set exportDocument to (expFolder & basename) as text end if -- necessary to avoid export write permissions issues on Sierra close access (open for access exportDocument) on error errmsg number errnbr my error_handler("Export file exportDocument", errnbr, errmsg) quit end try tell application "Pages" try set myDoc to open theFile with timeout of 1800 seconds if {"docx", "doc"} contains exportFormat then export myDoc to file exportDocument as Microsoft Word else 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 visible on all exported documents try -- occasionally get -8058 error which is caused by trying to duplicate -- a mounted drive with the Finder -- which is nonsense here, so ignore. tell application "Finder" if exists (item exportDocument as alias) then set extension hidden of (item exportDocument as alias) to false end if end tell on error errmsg number errnbr if not errnbr = -8058 then set errval to "Finder ext hidden: " & exportDocument as text my error_handler(errval, errnbr, errmsg) quit end if end try return end export_file on new_extension(afile, ext, name_flag) -- handler has two roles based on name_flag value -- 0) return full path of original filename with replacement extension -- 1) return just the basename without path set fullPath to ca's NSString's alloc()'s initWithString:(POSIX path of afile) set newfile to (fullPath's stringByDeletingPathExtension)'s stringByAppendingPathExtension:ext if name_flag = 1 then return (newfile's lastPathComponent()) as text end if return newfile as text end new_extension on lowercase (astr) -- make passed string all lowercase return ((ca's NSString's alloc()'s initWithString:astr)'s lowercaseString()) as text end lowercase 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 exportFormat to "" set expFolder to "" continue quit end quit

Feb 5, 2011 4:15 PM in response to Tom Murray2

Save/Export them to pdfs as per the tip. You must use this method if the documents are different page sizes and/or orientation.

Both methods are about the same steps. Although if your intention is to have a single starting document, forming that up in Pages is the way to go.

btw Why did you make separate documents if you want them all in one?

Peter

Feb 5, 2011 6:38 PM in response to Tom Murray2

You could use my version of #2 which does not involve opening all of the PDFs. Open the one you want as the first page & show the side bar, then select all of the other PDFs in Finder & drag the icons onto the icon of PDF #1 in its sidebar. All of the other PDFs will be added in the order they are sorted in Finder.

If PDF #1 has more than one page you can drop the others anywhere within the blue-bordered area. The line, as at the bottom of this screenshot will show you were you are dropping them.

If you don't drop the icons (either from Finder or another PDF's sidebar) in the blue-bordered area, Preview will not make a combined PDF.

User uploaded file

User uploaded file

Batch convert to pdf

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