• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Print to PDF
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Print to PDF


  • Subject: Re: Print to PDF
  • From: "Reese, Stevan" <email@hidden>
  • Date: Wed, 7 Mar 2007 15:29:04 -0800
  • Acceptlanguage: en-US
  • Thread-topic: Print to PDF

My previous solution used the AppleScript Action script to convert postscript to PDF. I changed it because the folder action begins processing the file when the file starts to be written to the folder. Usually this is OK but if the script gets to the end of the .ps file before the file write completes then it will error.
By using the print system the capability becomes available for all applications using the same process. Including Adobe apps. This is helpful in our shop because we have a process that requires a PDF made from Illustrator, as small as possible and as fast for the user as possible.
Regards
stevan


On 03/07/07 12:47 AM, "Peter Baxter" <email@hidden> wrote:

You could use the following script attached to a folder to print some
files as PDF files.
Just save a copy of your file to the folder that you attach this
script to.

on adding folder items to this_folder after receiving these_items
        set this_file to choose file
        try
                tell application "Image Events"
                        launch
                        -- get the parent folder of the image file
                        set the parent_folder to the container of this_file
                        -- derive new name for the new image file
                        set the new_name to my add_extension(this_file, "pdf")
                        -- look for an existing file
                        if (exists file new_name of the parent_folder) then
                                error "A file named "" & new_name & "" already exists."
                        end if
                        -- open the image file
                        set this_image to open this_file
                        -- save in new file. The result is a file ref to the new file
                        set the new_image to save this_image as PDF in ¬
                                file new_name of the parent_folder with icon
                        -- purge the open image data
                        close this_image
                end tell
                tell application "Finder"
                        -- delete the original file
                        delete this_file
                end tell
        on error error_message
                display dialog error_message
        end try
end adding folder items to
on add_extension(this_file, new_extension)
        set this_info to the info for this_file
        set this_name to the name of this_info
        set this_extension to the name extension of this_info
        if this_extension is missing value then
                set the default_name to this_name
        else
                set the default_name to ¬
                        text 1 thru -((length of this_extension) + 2) of this_name
        end if
        return (the default_name & "." & the new_extension)
end add_extension

Peter J Baxter
mail:  email@hidden

It's easy to play any musical instrument: all you have to do is touch
the right key at the right time and the instrument will play itself.
-- J.S. Bach


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden



Stevan
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Re: Print to PDF (From: Peter Baxter <email@hidden>)

  • Prev by Date: [Job Vacancy] AppleScript Developer Wanted!
  • Next by Date: (ReANN) Missing Link...
  • Previous by thread: Re: Print to PDF
  • Next by thread: LogoutHook not working
  • Index(es):
    • Date
    • Thread