Build your PDF and Excel reports with PHP
The Portable Document Format (PDF) and Microsoft's Excel spreadsheet are commonly used for presentation of reports and data. PHP, meanwhile, has become one of the most commonly used scripting languages on the web today, with 35 per cent of web sites running PHP. The TIOBE index of programming languages also indicates an …
If you can't use PECL
If you can't use PECL I highly recommend the FPDF class here: http://www.fpdf.org/
It's written entirely in PHP so you don't need to re-compile or install anything special to use it and it works on most versions of PHP from 4 onwards (it probably works with PHP3 but I've not tried it).
Dont wanna steal your thunder...
You could alway make it universally programtically available for excel by just making a plain html table and generate the file with a .xls extention... works perfectly!
:p
That;s only basic PDF
But if you really want to work with PDF's you cannot beat Coldfusion 8 from Adobe. You can simply take Full blown HTML with CSS etc and create a PDF directly, plus there is deep support for doing all sorts of things with PDF.
It's not open source, but if you have anything beyond basic PDF text to do or you need great looking PDF's, the cost of a standard CF license will be easily recovered
And the *nix version is ?
or do you only entertain Windows boxen ?
html2pdf
Or create html (with css) and use html2pdf from php
LaTeX?
LaTex is how I generate PDFs from PHP. Output the LaTex, process into PDF then serve up and depending on the case, cache for future access. Works very well for me.
ClibPDF Depreciated
Looks like ClibPDF is depreciated...
http://de3.php.net/manual/en/ref.cpdf.php
Uwe - if you mean the *nix version of this article then its identical, just different directory locations, as the scripting is all php based. however if you are talking bout the file formats then you may have a point but there is a pdf reader and open office for linux.
Apache POI with PHP-Java Bridge
Excel_Spreadsheet_Writer is still fairly basic. If you need more functionality, try using Apache POI from PHP. It'a actually a Java Application, but it's methods can easily be accessed from PHP using either the free or Zend PHP-Java bridge. If anyone's interested in more information james2 /at/ jfirth /point/ net
Lets not forget pdftk
The swiss army death ray of pdf toolkits.
So last year...
This is not the best article on ElReg.
The new way surely has to be Zend Framework for PDF writing. PEAR works, but ZF is superb and well structured.
http://framework.zend.com/
Another vote for ZF here.
Type your comment here — plain text only, no HTML
Been There, Done That
I've already been generating PDF files out of Perl for some time now, just by generating PostScript (OK, so I know a bit of PostScript ..... wouldn't call myself anything like fluent, but I know how to draw simple shapes and stick text on a page) and piping it through pdf2ps. You can even insert images saved as EPS straight into the stream. It doesn't half look impressive (although that's probably more to do with the perception of PDF as being used only for highly "official" documents). As a final touch, I even detected the user's OS and offered a link to an appropriate, non-Adobe PDF reader (healthy competition is a wonderful thing).
Also, if you generate a simple CSV file but give it the extension XLS, Excel will load it without missing a beat (Office doesn't really go for file extensions). You can even provide a second link to download the same file with a CSV extension (for Open Source users), so as not to scare anyone into thinking they absolutely need proprietary software.
Try phpPDF
Consider phpPDF. It's quite good
- Shelon Padmore
