I need to dinamicaly generate a PDF from HTML, but I have PDF Support disabled on my hosting, so is it possible to do without PDFlib GmbH library?
Thanks
There are many packages, but as I gather you're not able to install extra libs on your hosting. Options would be FPDF if you feel like rewriting your whole HTML into blocks, TCPDF if you feel a bit less masochistic, which has some limited html/css support.
The most common alternative is FPDF. It is pure PHP and needs no installed extensions.
An other nice option is dompdf, which is a HTML to PDF converter and is (almost) CSS 2.1 compliant. It can be used either using PDFLib or the R&OS CPDF class
You could also checkout htmldoc:
Project page
Related
How do I generate PDF files with PHP. php.net says that pdflib needs to be installed to use functions such as new_pdf ().
However, pdflib is not free and the lite version is not allowed for commercial use. I am confused. I would have thought PHP would have some built-in functionality to create PDF files.
How do I get through this as I do not want to use libraries such as fpdf, etc.?
You should try the following. They are some useful PHP libraries for PDF documents:
TCPDF
mPDF
DOM PDF
See Stack Overflow questions Generate PDF from HTML PHP and How to generate PDF files with PHP?.
It's your choice with which you feel more comfortable.
PHP does not have any in-built functions, so you have to use libraries. TCPDF is the easiest modules and it's free.
If you don't want to use pdflib, you will have to use another third-party library.
Zend provides one as part of the Zend Framework. But the ones we have used for various purposes are:
DomPDF is great for taking HTML and producing PDF files
tcPDF is a more class-based drawing style approach, but it works great and gives loads of control.
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 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.
I'm faced with having to generate some fairly basic PDFs on a server which is running php 4.3.2 unfortunately.
So that pretty much renders most things impossible such as google's domPDF etc.. PDFlib is not compiled in so I can't use any of that either.
Does anyone have any suggestions?
Thanks!
use this R&OS PDF Class to achieve this task.. This is fairly simple and light weight class and requires no module etc to be installed on the server.
You could try out DocRaptor.com, which is a webservice that will let you convert html to pdf.
I ended up using an older version of fpdf and HTML2PDF (from the link below.) It's certainly not ideal, but then neither is a 7 year old version of php.
http://www.macronimous.com/resources/Converting_HTML2PDF_using_PHP.asp
You didn't mention if you were generating these from scratch or from existing PDF data. pdftk is a handy PDF manipulation library. You can shell out to it from PHP.
I tried dompdf. It's a lot easier to use than other libraries I've tried but it doesn't have unicode support. Or rather, it has unicode support but requires another library called PDFLib ($1k version).
So I am just wondering if anybody has ever stumbled upon or used any PHP pdf library which is both easy to use and has unicode support.
I think fpdf supports that.
You can use TCPDF:
http://www.tcpdf.org/examples/example_008.pdf
http://www.tcpdf.org/examples/example_018.pdf
or you can use html2pdf - it's using tcpdf at its core but it's made to particularly convert html to pdf (css..):
Html2pdf
http://demo.html2pdf.fr/examples/pdf/utf8.pdf
and last but not least: mpdf
http://www.mpdf1.com/mpdf/index.php
maight be fastest and make smallest pdf in size ( then other two ). also has font_autodetect to detect and use unicode fonts.
Yes, fpdf supports it. I have used it to generate documents in various Indian languages.
The 0.6.0 release of DOMPDF will fully support Unicode. This version is currently in beta, but it's worth a try.