I am developing web based application, i need php reporting lib/class to make the job easy.
I need PDF/Excel format. The report based on related db tables(member bills, member info) Is there any advanced open source solution ?
Thanks
There are tons of reporting libraries, most of which create Xml or Csv. You would have to give more data about what kind of reporting you need for a recommendation. I haven't used PHPExcel yet, but it is the first attempt I have seen to actually create Excel documents rather than creating CSV's that will load in Excel. PDF creation is built into PHP with the PDF functions, and is fairly easy to do.
[UPDATE]
PHPExcel is archived now you can use PhpSpreadsheet instead.
A newer library that looks very promising is PHP Reports by jdorn on github.
This is unrelated to the older library by the same name hosted on Sourceforge.
A bit late, but you might want to check out RLib - works with PHP and MySQL and creates multiple different types - PDF, CSV, HTML etc.
http://rlib.sicompos.com/
Unfortunately I don't know of a decent reporting class in PHP.
Do you need a full reporting suite, or do you just need to be able to export data to the pdf and Excel file formats?
If you only need to create these kind of pages, the simplest solution would be to display the data you require and add CutePdf software which installs itself as a printer. Then you can print to pdf from the browser.
If you need to create pdf files on the server side, there is a pdf creation library in the Zend Framework. ZendFramework-1.8.1\library\Zend\Pdf
Related
I have to generate few reports in PDF format with some inventory stats (no graphs, only tables). Additionally, I have to generate some pdf labels for the placed orders and units in a nice tabular format (taking care of landscape orientation and line wrapping) for the web platform. Which PHP API/Library would be best suitable for this purpose. I am using Zend framework but Zend's PDF API is not rich enough to serve the cause.
One option I am considering is to use LateX for generating PDFs.
Advices? Suggestions?
There are several PDF generation libraries and executables.
I've used:
TCPDF
DOMPDF
html2pdf as #redreggae suggested
wkhtmltopdf
Many other alive & dead solutions
They all rendered HTML to PDF. The problem of all (except wkhtmltopdf) was that they all used different (non-standard) rendering engines and results were often different between them and unsatisfying. wkhtmltopdf uses WebKit to interpret the HTML and create a pdf file. I personally prefer wkhtmltopdf after trying/using (in production) all other of the ones listed.. There is one drawback to it - it is an executable and as such it must be called with exec() however this should not be a big issue when proper coding is applied such that you prevent code injection.
If you want something higher level than HTML to PDF converters, you can try PHPJasperXML, it's a renderer for JasperReports on pure PHP.
Which library is best to write PDF from HTML using Code Igniter?
Right now I'm using TCPDF, and it's taking much time to load a library.
Following are some useful PDF libraries & Tutorials for Codeignitor
PDF generation using dompdf
TCPDF-CodeIgniter Integration
Generating PDF files using CodeIgniter
mPDF with CodeIgniter
generating PDF files
Check out this article. The PDF library used there is quite fast and easy to use.
Since you're looking to convert HTML to a PDF, I highly recommend the wkhtmltopdf. It uses Qt and WebKit to generate PDF files of rendered markup, and even handles moderately complex JavaScript and AJAX. This makes it really useful for generating PDFs of pages that you have already created views and templates for, with the added benefit of being able to tweak and debug these pages with your browser. It works great for generating platform agnostic print views in your web app by normalizing the many nuances of various combinations of operating systems, web browsers, and printer drivers.
It's a stand-alone binary, so you may have trouble implementing it on shared hosting, but I used it recently on a project and could not have been more happy with it.
wkhtmltopdf: http://code.google.com/p/wkhtmltopdf/
My personal favorite PHP Library and API for it:
https://github.com/mikehaertl/phpwkhtmltopdf
Check out R&OS library R&OS pdf
i find it easy to implement
I'm trying to solve how to write PHP in order to execute a report with multiple sheets on OpenOffice spreadsheet file (AKA ods). Now I used this code for generate the OpenOffice spreadsheet report but it can display only one sheet:
<?php
// Export Calc SpreadSheet
header("Content-Type: application/vnd.ms-excel");
header('Content-Disposition: attachment; filename="Report.ods"');
?>
How I can solve this problem?
There are many libraries out there that are able to be used within PHP to create, edit, and serve up spreadsheet files, or Workbooks (which are a collection of sheets...actually the spreadsheet file IS a workbook, even if it is just a single sheet). There are very well known ones, and some not-so-well known ones out there.
Most people will point to these:
PHPExcel - https://phpexcel.codeplex.com/
Spreadsheet_Excel_Writer -
http://pear.php.net/manual/en/package.fileformats.spreadsheet-excel-writer.intro.php
ods-php - http://sourceforge.net/projects/ods-php/
openTBS -
http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html
there are a few more answers on questions like this one, but there is a daunting number of libraries and options.
My personal choice for a simple, small, openDocument format editor in PHP was ods-php, which is a single php file you include in your application, and instantiate. My use is not going to be creating ODS documents, but rather editing template files and serving up the edited document. You will have to write your own headers and echo the file contents in your own function in your PHP application, but that is not hard at all.
There is a [very] basic example php file included in the ods-php download that shows some of the functions, but if you can follow basic PHP logic, you can look through the library source and figure out its available functions. I'd say it would do just fine for what you need.
On the other hand, if you would rather have a bigger API at your disposal, and your server is decent enough to handle it, I'd recommend any of the other three. Keep in mind, the other three are rather large by comparison, and each has it's own strong and weak points:
PHPExcel is probably the most used by the free community, and is maintained on github constantly (last messed with 6 days ago), but is quite large. Documentation is available on the github site (I provided their old link, which links to their github).
Spreadsheet_Excel_Writer is tool from Pear, and is just as large, although it is no longer maintained, so what is there is 'as-is'. The Pear team is looking for someone to take over its maintenance, but what is there is as far as I can tell working.
openTBS is a single class library extension of the TBS engine (TinyButStrong). You have to install TBS in order to use openTBS, and it is a very good idea to enable zlib for compression capabilities of your files. If you go with openTBS, you not only get the ability to make xml based documents, but you get the functionality of the entire TBS engine at your disposal, which is quite nice if you would like to merge html source templates with your php scripts (check out the site, it might open some new frontiers for you).
there are definitely more libraries and tools out there, but these are the most notable ones I found in my search. My choice was guided by the driving force to keep my server tiny and standalone (it operates on a raspberry pi). If I were to choose a bulky, production environment API, I would probably choose PHPExcel because it has the support it needs to keep being up-to-date with M$' ever-adapting formats.
What is, according to you, the best way to convert uploaded files of any kind (.doc, .docx,...) into a pdf-file using nothing but php. Is it even possible to do so?
I looked at FPDF, but this creates the pdf files from text.
An other solution previously given was to use the PDFlib library on your server, but unfortunately, my server doesn't support this library...
What is the best way to convert to files my users upload on my site to pdf files?
A simpler approach would be to restrict uploads to .PDF format programmatically and require your users to only upload .pdf files. Provide a link on the upload page to a free and open source pdf printer (e.g. Cuteftp) that the user can install to create .pdf documents from any file that can be printed.
Trying to do it through PHP will be problematic because the uploads could be generated from many different programs that would be impossible to cater for in their entirety. e.g. How would it handle Scribus or ABC Flowcharter or any other 'non-standard' application someone used to create a document?
Much better to filter the upload upfront.
The best server-side PDF generator from those I tried was, so far, wkhtmltopdf, a WebKit-based, self-contained invisible browser that can render any HTML+CSS and generate a PDF from it. Reasonably fast and fairly reliable, has some useful PDF options, such as page size, orientation, etc.
The second part of the job in your case is to convert documents to HTML prior to feeding them to wkhtmltopdf. If possible, have your users upload the docs in HTML (Word and Co. can export (crappy) HTML). If this is not an option, you will have to find a tool just for that, which, in my opinion, is much easier than finding a tool that converts Word docs directly into PDF.
Good thing about wkhtmltopdf is also that you can feed the output of your PHP script to it using the ob_xxx() functions.
PHP Excel best simple way to create doc, docx, xls, xlsx, pdf files with PHP. Its lot easier with clear documentation.
Use Microsoft Office to render Microsoft Office documents, if you care about accuracy at all. This is easily done by invoking Office over COM.
Get access to your server, and install what you need. Doing so would be far easier than monkeying around with sub-par solutions.
Well... I can think of one way of doing it quite easily, but it doesn't involve using PHP.
Upload your documents to a folder on your server, that are browsable by your users.
EG: http://mysite.com/docs/
Then get your users to install a virtual printer driver such as Primo PDF
http://www.primopdf.com/index.aspx
then they can load the document into their browser, and print to PDF for offline browsing.
If this is not an option, and your dealing with office documents that conform to the openXML standard, you could attempt to parse the XML doc into a PHP page for display in the browser, then use JavaScript to trigger a print.
Unfortunately, it does still depend on your user having a PDF printer installed.
Alternatively, you could just load the docs natively, and print to your own PDF printer, then upload the PDF's to the web server for download.
I can't think of any easy way of doing this otherwise, without installing all sorts of different document parser tool-kits and doing a huge amount of behind the scenes work.
i am building a simple system using PHP that allow people to Add, Delete, and View data.
Can anyone tell me how to view the uploaded data in PDF format?
There are a bunch of options. The ones I like are:
wkhtml2pdf - A command-line tool that uses the WebKit HTML rendering engine to generate PDFs from HTML docs. Very easy to use, assuming you're able to get it installed on your server, and your requirements aren't too stringent. You just generate HTML/CSS, and use PHP's shell-exec functions to run it, and voila.
Zend_Pdf - Part of the Zend Framework, but like almost all ZF components, you can use it stand-alone. Programmatically build PDFs.
tcpdf, fpdf (with fpdi if you want to import existing PDFs and write over the top of them) - older, uglier, but effective.
There's also the commercial PDFLib, which used to be the best thing around, but I don't remember much about it. Included for approximate completeness.
Take a look at PDFLib, or its deprecated predecessor.