Page 1 of 1

ghostscript on linux

Posted: Fri Jun 13, 2003 2:24 pm
by koorb
Righty ...

What Im doing is creating a application for a client that allows users to select pre-made pdf docs, that are then merged into one document using ghostscript and emailed to them.

Bellow is the script to merge the selected docs;

Code: Select all

$command = 'gswin32c -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output/' . $_POST['filename'];

foreach($_POST['files'] as $file) {

    $command .= ' files/' . $file;

}

passthru($command, $ret_var);
gswin32c being the command line .exe file for Ghostscript. So far so good, Now I need to upload this to a web host (shared hosting) on LINUX!!!! so I need a Ghostscript command line file, executable ? for linux. Now I have used linux (mandrake) and i know it all comes as source most of the time, but basicly I dont have the time or resources to install linux just to 'make' this file, can anyone advise/help me here.

I am awhere that my host may not allow this sort of php, passthru/exec/system functions, uptill now it hasnt been promising,(I will have to contact them). but if anyone has done this before, or can send a linux copy of gs to me, i would be very grateful to say the least.

Posted: Fri Jun 13, 2003 3:19 pm
by BDKR
There are online man pages. Find the online manpage for Ghostscript. I will say that based on looking at the output from my man file, the line you have should work. All you should need to do is change gswin32c to gs.

Also, can you telnet (bad) or ssh (good) into the server? If so, ssh (or telnet) in and hack out the command by hand. If it works, you're in business. :wink:

Hope that helps,
BDKR

Posted: Fri Jun 13, 2003 3:34 pm
by koorb
pardon my ignorence :D man ? manual as in documentation ?

Posted: Fri Jun 13, 2003 4:03 pm
by cactus
Yep, man = manual -> HERE :)

Regards,

Posted: Fri Jun 13, 2003 7:18 pm
by koorb
thats great, thanks. So if I just change the 'gswin32c' to 'gs' in the code. I assume I then need the linux executable called 'gs' to replace the gswin32c.exe file ? Where can i get that ?

Posted: Fri Jun 13, 2003 8:09 pm
by cactus
BDKR wrote:Also, can you telnet (bad) or ssh (good) into the server?
koorb, are you able to access your server in this manner ?

If so, once your logged in, at the prompt type "which gs" and it will return a path to "gs" if installed.

Regards,

BTW, puTTY is probably the best Win32 Telnet/SSH client, IMO.

Posted: Sat Jun 14, 2003 4:44 am
by koorb
sadly not ! :(. am i just better off forgetting this untill I have a host with better access ?
I was under the impresion that if i replaced the windows exe with a linux executable then that would do the trick ? is this not the case.

Posted: Sat Jun 14, 2003 5:40 am
by twigletmac
I've moved this to Miscellaneous as it's not a PHP question.

Mac

Posted: Sat Jun 14, 2003 6:59 am
by cactus
koorb, you could try it on your host, many distro's have ghostscript as standard, it's just a question of whether the host admins installed the package or whether they have added it after (or not at all!).

Does'nt hurt to give it a try (all it can do is throw an error) and as BDKR says:
.......All you should need to do is change gswin32c to gs.
Regards,

Posted: Sat Jun 14, 2003 12:37 pm
by koorb
ohhhhhhhhhhhhhhhhhh! i c what ya mean, sorry- blond moment ! :|