How do I render a pdf from a php page which has backgrounds, images and text?
-
I want to send a dynamic page for printing to labels using fpdf, however I'm not entirely sure how to get fpdf to display the contents of my php file. The php file renders a page with the users url, avatar, custom user background and name in a contactcard.php file. How would i go about sending this to pdf, using fpdf or a similar resource? The backgrounds, images, texts are all unique to the user and pulled from the database. How can you create avery labels using php/css and then sending to pdf for printing?
-
Answer:
i've found the best solution to this is to use the wkhtmltopdf binary (http://code.google.com/p/wkhtmltopdf/). It runs on most linux systems. (See here for caveats: http://blog.behance.net/dev/wkhtmltopdf-wkhtmltoimage-x-centos-x-xen-segfault-mania ). Since it sounds like you already have an html page formatted the way you want, creating a pdf is pretty simple. From the wkhtmltopdf page; wkhtmltopdf www.myhomepage.com myhomepage.pdf The first argument is the URL of the page you're trying to create a pdf of. The second is where wkhtmltopdf will create the file. From there, you can do anything you need to with it. Store it, email it, etc.
Chris Henry at Quora Visit the source
Other answers
I use http://www.pdfservices.net, create pdf from files html, css, php, ajax, mysql, image, printable and auto-print is better than any class Iâve used.
Mirate Eso
Related Q & A:
- How do I convert a PDF file to PDF/A in Delphi?Best solution by softwarerecs.stackexchange.com
- How can I parse a complex XML with PHP and CDATA?Best solution by Stack Overflow
- How do I open a pdf file in my e'mail attachment?Best solution by Yahoo! Answers
- How do I open a pdf on an email?Best solution by ehow.com
- How do I add a photo to a Wikipedia page?Best solution by en.wikipedia.org
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.