Reply to Re: joining pdf files in php

Your name:

Reply:


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

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация