Re: Making JPEG thumbnails of PDF files
Re: Making JPEG thumbnails of PDF files
- Subject: Re: Making JPEG thumbnails of PDF files
- From: Timothy Bates <email@hidden>
- Date: Wed, 10 Oct 2001 21:58:53 +1000
QuickTime can do this.
You can use the app PixelPipe by Chad Magendanz (a cool guy).
This scriptable app is _unbelievably powerful_ (reduce, rotate, export etc
etc.) and costs the exact sum of $0.00
<
http://www.halcyon.com/chad/>
Or you can script QT player to do it. Check out the examples on the apple AS
page, or modify this (which I have as a toolbar script in my X finder
(mostly stolen from the apple example))
property destination_folder : "Cortex:Users:tim:Desktop"
tell application "QuickTime Player"
tell application "Finder"
set thefile to the selection as alias
set the destination_folder to the container of thefile
end tell
open thefile
my convert2JPEG()
end tell
on convert2JPEG()
try
tell application "QuickTime Player"
try
set current_name to the name of movie 1
if the length of current_name is greater than 27 then ,
set current_name to ((characters 1 thru 27 of
current_name) as string)
on error
set current_name to "untitled"
end try
set item_path to ((destination_folder as string) & current_name)
as string
-- create a unique temp folder
repeat
set this_name to (random number from 100000 to 999999) as
string
tell application "Finder"
if not (exists folder this_name of the desktop) then
set the temp_folder to (make new folder at desktop
with properties {name:this_name}) as alias
exit repeat
end if
end tell
end repeat
set the tempfile_name to "TEMP_IMAGE"
set the target_file to ((temp_folder as string) & tempfile_name)
-- export the image as a JPEG
export movie 1 to file target_file as image sequence using
settings preset "JPEG, 25 fps"
close movie 1 saving no
end tell
tell application "Finder"
--rename the image and move it to the desktop or other folder
set the new_name to (my add_extension(current_name))
set the name of the first file of the temp_folder whose name
ends with "1.jpg" to the new_name
set this_image to move file new_name of the temp_folder to the
destination_folder with replacing
-- change the file type to open in Preview
set the creator type of this_image to "prvw"
-- delete the temp folder and its contents
delete temp_folder
--empty trash
end tell
return true
on error error_message
return error_message
end try
end convert2JPEG
add_extension("Picture 2.tiff")
on add_extension(this_name)
if the length of this_name is greater than 4 then
set the name_ending to (characters -4 thru -1 of this_name) as
string
if the name_ending is in {".jpg", ".tif", ".pct", ".gif"} then
set this_name to (characters 1 thru -5 of this_name) as string
end if
set the name_ending to (characters -5 thru -1 of this_name) as
string
if name_ending is in {".tiff"} then
set this_name to (characters 1 thru -6 of this_name) as string
end if
end if
if the length of this_name is greater than 27 then
set this_name to (characters 1 thru 27 of this_name) as string
end if
set this_name to (this_name & ".jpg") as string
return this_name
end add_extension
On 10/10/01 7:34 PM, "Simon Forster" <email@hidden> wrote:
>
Help!
>
>
Bit stuck here.
>
>
I need a simple, AppleScriptable way of creating JPEG thumbnails from
>
PDF originals in Mac OS 9.x. The best option so far seems to be Acrobat
>
5.0 which'll convert a file to JPEGs which I can then resize. However,
>
Acrobat's Save As JPEG option does not seem to be AppleScriptable (in
>
fact I find Acrobats's dictionary very opaque) and I really do not want
>
to use Prefab Player!
>
>
Is Acrobat 5.0 the best tool for the job?
>
>
Can I script this in a simple manner? (Well, obviously I cannot at the
>
moment 'cause otherwise I wouldn't be writing this email :-)
>
>
Anyone got any ideas or code snippets to help me in this incredibly
>
simple sounding task?
>
>
TIA
>
>
Simon Forster
>
________________________________________________
>
LDML Ltd, 4/5 Hazlitt Mews, London, W14 0JZ, UK
>
<tel int="+44 20 7602 9370" uk="020 7602 9370">
>
<fax int="+44 20 7371 6662" uk="020 7371 6662">
>
<mailto:email@hidden>
>
________________________________________________
>
_______________________________________________
>
applescript-users mailing list
>
email@hidden
>
http://www.lists.apple.com/mailman/listinfo/applescript-users
Dr Timothy Bates <
mailto:email@hidden>
Macquarie Centre for Cognitive Science (MACCS)
Macquarie University
Ph 61 (2) 9850 8623
Fx 61 (2) 9850 6059