ghostscript on linux

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
koorb
Forum Newbie
Posts: 5
Joined: Fri Jun 13, 2003 2:24 pm
Location: uk

ghostscript on linux

Post 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.
User avatar
BDKR
DevNet Resident
Posts: 1207
Joined: Sat Jun 08, 2002 1:24 pm
Location: Florida
Contact:

Post 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
koorb
Forum Newbie
Posts: 5
Joined: Fri Jun 13, 2003 2:24 pm
Location: uk

Post by koorb »

pardon my ignorence :D man ? manual as in documentation ?
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post by cactus »

Yep, man = manual -> HERE :)

Regards,
koorb
Forum Newbie
Posts: 5
Joined: Fri Jun 13, 2003 2:24 pm
Location: uk

Post 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 ?
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post 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.
koorb
Forum Newbie
Posts: 5
Joined: Fri Jun 13, 2003 2:24 pm
Location: uk

Post 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.
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

I've moved this to Miscellaneous as it's not a PHP question.

Mac
User avatar
cactus
Forum Regular
Posts: 343
Joined: Tue Jun 10, 2003 4:16 am
Location: UK

Post 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,
koorb
Forum Newbie
Posts: 5
Joined: Fri Jun 13, 2003 2:24 pm
Location: uk

Post by koorb »

ohhhhhhhhhhhhhhhhhh! i c what ya mean, sorry- blond moment ! :|
Post Reply