|
Posted by Toby Inkster on 02/05/06 17:37
Paul Czubilinski wrote:
> I would like to join few pdf files uploaded separetly into my website
> into one downloable pdf file.
If you've got Ghostscript installed on your server, it's easy enough to
join a few PDFs together...
<?php
# Where is Ghostscript installed?
$gs = '/usr/bin/gs';
# Which files do we want to join together?
# Specify them in the right order!
$infiles = array(
'/home/me/public_html/pdf/coverpage.pdf',
'/home/me/public_html/pdf/part1.pdf',
'/home/me/public_html/pdf/part2.pdf',
'/home/me/public_html/pdf/part3.pdf',
'/home/me/public_html/pdf/index.pdf'
);
# What is the output file name?
$outfile = '/home/me/public_html/pdf/out.pdf';
# Assemble arguments to supply to Ghostscript.
$args = "-dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite ";
$args .= "-sOutputFile='{$outfile}' ";
foreach ($infiles as $f)
$args .= "'{$f}' ";
# Call Ghostscript to do the real work.
system("$gs $args");
?>
--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact
Navigation:
[Reply to this message]
|