Re: Height and Width of Page in PostScript
Re: Height and Width of Page in PostScript
- Subject: Re: Height and Width of Page in PostScript
- From: Dieter May <email@hidden>
- Date: Tue, 28 Oct 2003 20:42:36 +0100
Hi,
ghostscript can do this. It also works with PDF and EPS. To get the Bounding-Box direct from the ps-file is not so easy, I think.
-----------------
on ProcessAFile(aFile)
set theInFile to "'" & (POSIX path of the aFile) & "'"
set MyGSPath to do shell script "which gs"
set MyBBox to (system MyGSPath & " -dNOPAUSE -dBATCH -sDEVICE=bbox " & theInFile)
theMessage(MyBBox)
end ProcessAFile
on open of fileList
repeat with aFile in fileList
ProcessAFile(contents of aFile)
end repeat
end open
on run
set aFile to choose file
set MyBBox to ProcessAFile(aFile)
end run
on theMessage(MyBBox)
set text item delimiters to "."
set MyBBox to (text items of MyBBox)
set text item delimiters to ","
set MyBBox to MyBBox as text
set AppleScript's text item delimiters to "%%BoundingBox: "
set myBBoxes to (text item 2 of MyBBox)
set AppleScript's text item delimiters to "%%HiResBoundingBox: "
set {myBBox1, myBBox2} to (text items of myBBoxes)
set AppleScript's text item delimiters to " "
set {x, y, b, h} to words of myBBox1
set {x2, y2, b2, h2} to words of myBBox2
set AppleScript's text item delimiters to ""
set {b, h} to {b - x, h - y}
set {b2, h2} to {b2 - x2, h2 - y2}
set myString to "Breite, Hvhe: " & (b as string) & " pt x " & (h as string) & " pt" & ,
return & "High-Res: " & (b2 as string) & " pt x " & (h2 as string) & " pt" & return
display dialog myString buttons {"Thanks"} default button 1 giving up after 60
end theMessage
--------------
Dieter
email@hidden am 27.10.2003
>
Does anyone know how to get the page size of a PostScript file (presumably by
>
opening it for access)? I need a script that tells me if a page's width is
>
greater than its heighth.
>
Thanks,
>
Garry Simon
>
_______________________________________________
>
applescript-users mailing list | email@hidden
>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
>
Do not post admin requests to the list. They will be ignored.
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.