A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearHow to convert documents to PDF on a Linux/PHP stack? - page 1
User InfoPosts
How to convert documents to PDF on a Linux/PHP stack?#1
I want to display documents on my website. The server is hosted on a Debian machine. I was thinking I can allow the upload of support documents then use a Linux app or PHP app to convert the doc into PDF and display that in an HTML page. Are there any APIs or binaries that allow me to do this?

posted date: 2008-12-17 23:46:00


Re: How to convert documents to PDF on a Linux/PHP stack?#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-17 23:46:01


Re: How to convert documents to PDF on a Linux/PHP stack?#3
If it is an office document, one option would be to use openoffice in headless mode. See here for a python script that shows how: http://www.oooninja.com/2008/02/batch-command-line-file-conversion-with.htmlIf it is any other kind of document (e.g. your own XML document), then you would need to do a bit more work. I have had some success using XSL to define a translation to docbook format, then using docbook tools to generate the PDF (and various other formats). You could also use XSL to go straight to PDF if you need more precise control over how things look.

posted date: 2008-12-18 00:34:00


Re: How to convert documents to PDF on a Linux/PHP stack?#4
Pear has a PHP PDF class:http://pear.php.net/package/File_PDFhttp://pear.php.net/package/File_PDF/docs/latest/apidoc/File_PDF/File_PDF.htmlNathan Coffield, Support Engineer, HostMySite.com

posted date: 2008-12-18 07:27:00


Re: How to convert documents to PDF on a Linux/PHP stack?#5
An alternative method is to generate an HTML file that contains what you need in the pdf. Then use htmldoc to convert it to a PDF.http://www.easysw.com/htmldoc/It actually is much easier than directly manipulating the objects in a PDF doc.

posted date: 2008-12-18 07:30:00


Re: How to convert documents to PDF on a Linux/PHP stack?#6
You can create a PDF print-to-file printer and send any number of documents to the printer via lpr. function lpr($STR,$PRN,$TITLE) { $prn=(isset($PRN) && strlen($PRN))?"$PRN":C_DEFAULTPRN ; $title=(isset($TITLE))?"$TITLE":"stdin" . rand() ; $CMDLINE="lpr -P $prn -T $title"; $pipe=popen("$CMDLINE" , 'w'); if (!$pipe) {print "pipe failed."; return ""; } fwrite($pipe,$STR); pclose($pipe); } // lpr()//open document...//read into $sourcelpr($source, "PDF", $title); //print to deviceexit();Also HTMLDOC can convert your HTML into a PDF.

posted date: 2008-12-18 07:50:00


Re: How to convert documents to PDF on a Linux/PHP stack?#7
You might also want to take a look at http://www.fpdf.org/.

posted date: 2008-12-18 08:07:00


Re: How to convert documents to PDF on a Linux/PHP stack?#8
A relatively new project, called phpLiveDocx can convert DOC to PDF (in addition to a number of other formats). It is a SOAP based service and can be used completely free of charge. For sample code to convert a DOC to PDF using phpLiveDocx, take a look at this recent blog post:http://www.phplivedocx.org/2009/02/06/convert-doc-to-pdf-in-php/Of course, as it is SOAP based, it can be used on all operating systems that support PHP :-)

posted date: 2009-02-17 04:23:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.