On Sat, Mar 27, 2010 at 4:41 AM, Rob Gould <gouldimg@xxxxxx> wrote: > Is there a free solution out there that will enable me to take a > PHP-generated postscript output file, and dynamically, on-the-fly convert it > to a PDF document and send to the user as a download when the user clients > on a link? > > [...] > > 3) I've got a PHP file that takes that input and generates a custom > Postscript file from it, which I presently serve back to the user. On a > Mac, Safari and Firefox automatically take the .ps output and render it in > Preview. > > [...] > I think you're looking for a PHP library that can take the output from the function that produces the PS file and generates a PDF file which you then send back to the user. I haven't come across such a utility. I recommend generating a PDF file directly using PDFLib or FPDF ( http://www.fpdf.org/) if possible. An alternative strategy (if you cannot create a PDF directly) could be: 1. Validate input and Generate PS file then go to 2 otherwise raise input exception and exit 2. Write (1) to a temporary location then go to 3 otherwise raise file generation exception and exit 3, Use a utility like ps2pdf (or ghostscript) to convert file to pdf then go to 4 otherwise raise file conversion exception and exit 4. Serve (3) then go to 5 otherwise raise file transfer exception and exit 5. Delete files and exit normally Tutorial on ps2pdf: http://www.linux.com/archive/feed/35022