Re: How to save a PDF as a postscript file?
Re: How to save a PDF as a postscript file?
- Subject: Re: How to save a PDF as a postscript file?
- From: "Mark J. Reed" <email@hidden>
- Date: Tue, 29 May 2007 10:18:11 -0400
Just to get my reply into the right thread....
On 5/29/07, Richard Rönnbäck <email@hidden> wrote:
I need to convert PDF files to postscript and I thought maybe I could use
call the same process that is launched when you choose print->Save PDF as
postscript
However, it does not appear to be a PDF Services workflow, or at least I am
not able to find where it resides.
I have however found out that it calls the command
/usr/libexec/cups/filter/cgpdftops
but I can't figure out how to call that either. Can someone help me out
here?
That program is part of the internal workings of CUPS, and so not
designed in a user-friendly fashion. You can use it, but be prepared
for some seemingly irrelevant requirements. It requires five
command-line arguments:
1. The name of the job (as it shows up in the printer queue, usually
as printername-##). You can put any string you want here.
2. The user who originally submitted the job. $USER is the safest
thing to put here.
3. The title of the document. Again, arbitrary.
4. The number of copies. This one is important - assuming you only
want to have one copy of the PDF in the output PostScript file, put a 1 here.
5. A set of options that are part of the print driver configuration.
This argument is mandatory, so if you don't want to pass any options,
you have to put an empty string here (e.g. '' (apostrophe apostrophe)
in the shell script command string).
To call it from AppleScript, it would look something like this. Note
that the "set shellCommand" statement should be all on one line all
the way through "quoted form of psFile".
set pdfFile to POSIX path of (choose file with prompt "Select PDF file
to convert")
set oldTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to {"."}
set psList to {first text item of pdfFile, "ps"}
set psFile to psList as string
set AppleScript's text item delimiters to oldTID
set shellCommand to "/usr/libexec/cups/filter/cgpdftops job $USER
title 1 '' <" & quoted form of pdfFile & " >" & quoted form of psFile
do shell script shellCommand
--
Mark J. Reed <email@hidden>
_______________________________________________
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