Exporting Pages documents is done using the export command from the Pages Suite.
exportv : Export a presentation to another file(s).
exportdocument : The presentation to export.
to (file ) : A reference to the file to be created.
as ( epub / Microsoft Word / Pages 09 / PDF / unformatted text ) : The format in which the document is to be exported.
[ with properties (export options ) ] : An AppleScript record containing property:value pairings for the initial values for properties of the exported object.
export optionsn : The export options for the Pagesexport command.
properties
author ( text ) : The author of the exported EPUB document.
cover ( boolean ) : Should the first page be used as the cover for the exported EPUB document?
genre ( text ) : (Pages 5.6) The genre of the exported EPUB document.
language ( text ) : (Pages 5.6) The language name or ISO language code of the exported EPUB document. For ISO language codes, see Code List of ISO 639-2.
publisher ( text ) : (Pages 5.6) The publisher of the exported EPUB document.
title ( text ) : The title of the exported EUPB document.
image quality ( good/better/best ) : (Pages 5.6) The quality setting to apply to the images contained in the exported document.
password ( text ) : The password to use when the exported PDF is encrypted.
password hint ( text ) : The password hint.
NOTE: The Pages version 5.6 scripting dictionary includes enhanced metadata options for EPUB documents, as well as image compression options for images placed within the exported document.
Export Scripts
The following are script examples for each of the following export types:
DO THIS ►DOWNLOAD a ZIP archive containing two Pages documents to use for testing the export command. Included in the archive are completed versions of Alice in Wonderland and the United States Constitution.
This script movies the frontmost Pages presentation to a PDF file. Set the boolean value of the useEncryptionDefaultValue property to either true or false to determine whether you will be prompted for the password to use in encrypting the PDF file.
Export to PDF
01
propertyexportFileExtension : "pdf"
02
propertyuseEncryptionDefaultValue : true
03
04
-- THE DESTINATION FOLDER
05
-- (see the "path" to command in the Standard Additions dictionary for other locations, such as movies folder, pictures folder, desktop folder)
06
set thedefaultDestinationFolderto (path todocuments folder)
07
08
setusePDFEncryptiontouseEncryptionDefaultValue
09
tellapplication "Pages"
10
activate
11
try
12
if not (existsdocument 1) then errornumber -128
13
14
ifusePDFEncryptionistruethen
15
-- PROMPT FOR PASSWORD (OPTIONAL)
16
repeat
17
display dialog "Enter a password for the PDF file:" default answer ¬
18
"" buttons {"Cancel", "No Password", "OK"} ¬
19
default button 3 withhidden answer
20
copy theresultto ¬
21
{button returned:buttonPressed, text returned:firstPassword}
22
ifbuttonPressedis "No Password" then
23
setusePDFEncryptiontofalse
24
exit repeat
25
else
26
display dialog "Enter the password again:" default answer ¬
27
"" buttons {"Cancel", "No Password", "OK"} ¬
28
default button 3 withhidden answer
29
copy theresultto ¬
30
{button returned:buttonPressed, text returned:secondPassword}
DOWNLOAD an example AppleScript droplet that will export dragged-on Pages documents to PDF files placed in the same folder as the Pages source files.
DISCLAIMER
THIS WEBSITE IS NOT HOSTED BY APPLE INC.
Mention of third-party websites and products is for informational purposes only and constitutes neither an endorsement nor a recommendation. MACOSXAUTOMATION.COM assumes no responsibility with regard to the selection, performance or use of information or products found at third-party websites. MACOSXAUTOMATION.COM provides this only as a convenience to our users. MACOSXAUTOMATION.COM has not tested the information found on these sites and makes no representations regarding its accuracy or reliability. There are risks inherent in the use of any information or products found on the Internet, and MACOSXAUTOMATION.COM assumes no responsibility in this regard. Please understand that a third-party site is independent from MACOSXAUTOMATION.COM and that MACOSXAUTOMATION.COM has no control over the content on that website. Please contact the vendor for additional information.