Sitemap

Amicuk Programming Answers

How to convert Numbers files to pdf

-0001-11-30   Views:0

Advertisement

Hi.  I have a large number of Numbers documents I want to give to my book-keeper.  She doesn't use a Mac, so she can't use Numbers files.  I want to convert them to PDF so she can view them.  I've been converting them manually.  This is what I do: 1)

Hi.  I have a large number of Numbers documents I want to give to my book-keeper.  She doesn't use a Mac, so she can't use Numbers files.  I want to convert them to PDF so she can view them. 
I've been converting them manually.  This is what I do:
1)  Open the Numbers file.
2)  Choose Print.
3)  Select "All Sheets".  This is important because I have 5 sheets in each document.
4)  Choose "Save as PDF".
5)  The default name is fine, so press OK.
6)  Close the Numbers file.
I have hundreds of these files.  Is there a way I can automate the process of converting them?
Thanks for the help!

The replay answer
Advertisement
Hello
You may try the following script. It will ask you to choose folder where Numbers files reside and then export every Numbers file in the chosen folder as PDF. Export destination folder will be the last folder you used for export. So you'd better export one file in advance and select the export destination folder you want to use. It will replace existing pdf file in destination folder.
Menu text are assumed in English and hard coded in script. For languages other than English, please edit the following three properties in export_as_pdf() handler:
property export_menu : "Export…"
property image_quality : "Good" -- Good | Better | Best
property layout : "Sheet View" -- Sheet View | Page View
The first one is menu item name of File > Export… (note … is U+2026 HORIZONTAL ELLIPSIS, which can be inputted by option ; in English keyboard for instance) and the rest are for options in Export sheet.
Tested with Numbers 2.0.5 under OSX 10.6.5.
Hope this may help,
H
_main()
on _main()
    script o
        property ff : {}
        property xx : {}
        property yy : {}
        set f to choose folder with prompt "Choose folder of Numbers files"
        tell application "Finder"
            set ff to (files of f whose name ends with ".numbers") as alias list
        end tell
        tell application "Numbers" to launch
        repeat with f in my ff
            tell application "Numbers"
                tell (open f)
                    if my export_as_pdf("", {_replace:true}) then
                        set end of my xx to f
                    else
                        set end of my yy to f
                    end if
                    close
                end tell
            end tell
        end repeat
        tell application "Numbers"
            display dialog "Exported " & (count my xx) & " of " & (count my ff) & " files." giving up after 20
        end tell
    end script
    tell o to run
end _main
on export_as_pdf(pdfname, {_replace:_replace})
        string pdfname : output pdf file name (pdfname = "" denotes the current name whose extension is replaced with "pdf")
        boolean _replace : true to replace existing pdfname, false otherwise
        return boolean : true if operation is not canceled, false otherwise (in case _replace = false and pdfname already exists)
    script o
        property export_menu : "Export…"
        property image_quality : "Good" -- Good | Better | Best
        property layout : "Sheet View" -- Sheet View | Page View
        property _canceled : false
        tell application "Numbers"
            activate
            if pdfname ≠ "" then set the clipboard to pdfname
        end tell
        tell application "System Events"
            tell process "Numbers"
                tell menu bar 1's menu bar item 3 -- File
                    tell menu 1's menu item export_menu -- Export…
                        click
                    end tell
                end tell
                tell (window 1 whose subrole = "AXStandardWindow")
                    tell sheet 1
                        tell radio group 1
                            tell radio button 1 -- PDF
                                if value ≠ 1 then click
                            end tell
                        end tell
                        tell pop up button 2 -- Image Quality
                            if value ≠ image_quality then
                                click
                                tell menu 1's menu item image_quality
                                    click
                                end tell
                            end if
                        end tell
                        tell pop up button 1 -- Layout
                            if value ≠ layout then
                                click
                                tell menu 1's menu item layout
                                    click
                                end tell
                            end if
                        end tell
                        tell button 1 -- Next…
                            click
                        end tell
                    end tell
                end tell
                --keystroke "d" using {command down} -- desktop
                if pdfname ≠ "" then keystroke "av" using {command down} -- select all and paste in file name
                keystroke return
                tell (window 1 whose subrole = "AXStandardWindow")
                    tell sheet 1 -- save sheet
                        repeat while exists
                            delay 0.1
                            tell sheet 1 -- alert sheet (already exists)
                                if exists then
                                    if _replace then
                                        click button 1 -- Replace
                                    else
                                        click button 2 -- Cancel
                                        set _canceled to true
                                    end if
                                end if
                            end tell
                            if _canceled then click button 3 -- Cancel
                        end repeat
                    end tell
                end tell
            end tell
        end tell
        return not _canceled
    end script
    tell o to run
end export_as_pdf

Go to See the other 7 answers

Hot
Hi!! I'm have an applet (named say applet.class) in an html page that has a public method like this.... public void doShowFrame()           Frame frame = new frame();      frame.setVisible (true); What I want to do is to call that method with javascr [More]
I subscribe to a lot of podcasts - UP, IGN, TwiT, etc., and they all work fine instead of UP's. However, it doesn't appear to be a problem on their end. If I download their podcasts via Juice or directly from the web site, they work fine. However, if [More]
Oracle Production DB is :9i, UNIX Aix 5.2 Application server :10g, Os: win 2008 Application server : Mendix Application server. Error:Error: ORA-00604: error occurred at recursive SQL level 1 ORA-01882: timezone region not found : Can't create a new [More]
I am facing problem while deployment of my application I am using log4j api and its in debug mode as following log4j.rootCategory=DEBUG, A2 log4j.appender.A2=org.apache.log4j.DailyRollingFileAppender log4j.appender.A2.file=D:/logs/directory.log log4j [More]
What's the best display for under £150 to pair with the the iMac 21.5 inch 2013? In terms of best match resolution dimensions etc?I would highly recomend this one: http://www.amazon.com/AOC-i2367Fh-23-Inch-Screen-Monitor/dp/B009V8F700/ref=sr_1_ 2?ie= [More]
i have looked around and found this issue in older posts from 2008 but have not found a resolution. i've had dw cs4 for mac for a several months and all of a sudden it started crashing when i select code/split view. i have: deleted prefs deleted conf [More]
I recently installed new version of Symantec Endpoint anti virus software.  MY 3 Apple TV's are not showing in my iTunes Devices unless I disable Symantec Endpoint Protection.  Does anyone know what setting need to change for Symantec of Firewall to [More]
Hello, From standard PCUI, which used to create partner, I want to get a value partner and send it to a view that content Webdynpro Abap through portal Event. Is it possible? How? Thanks.Hello, Could you please clarify your question? Thanks and Regar [More]
I maintain a page with 400x300 screen shots of charts on it. I like to update it during the day. Many people in my chat room view the page. What is the quickest way to update it? At the moment, I have the page open as a Local File. Snagit saves the s [More]
I want to use my macbook for an input in my audio system. I am going to stream audio, but because I intend to use it in a darkened room, I wish to be able to make the screen shut off. Is there a command to do that or another way to do it? Thanks.trit [More]