Board index   FAQ   Search  
Register  Login
Board index PHP PHP General

How to print pdf report based on template?

General discussions related to php

Moderators: macek, egami, gesf

How to print pdf report based on template?

Postby marto » Fri May 17, 2013 1:22 am

Hi all,

I'm not a native English speaker, so please excuse any errors.

I'm a programmer but I'm new to PHP technology and I'm looking for a solution to create pdf reports based on templates.
I mean something similar to what can ben done in other technologies, e.g. JasperReport in Java, that is having a template describing how data will be accomodated on the page and that can be processed feeding data to some engine or piece of logic able to interpret the template.
I need to crete complicated reports, using groups (i.e. repeating tabular data grouped based on some criterion), headers, footer and images, all without having to go through html renderization, because I need to control page breaks too.

I already did a lot of searching on the web and in forums (this one too), but didn't find anything able to do all of this stuff; the solutions I found by now closest to my needs are PDFTemplate (a PHP class I found on another forum, don't know if I can post the link) and SpoolTemplate (http://www.andrioli.com/en/sptpl.html), the latter is a simple report engine, but neither is capable to manage the complexity I need.
I also looked at Smarty template engine (http://www.smarty.net) but it seems to be thought to simplify creation of complex html pages and I need to not render html.

Is there any free, powerful and flexible solution to achieve what I need?

Thanks for any help or idea.
marto
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri May 17, 2013 12:13 am
Location: Italy

Re: How to print pdf report based on template?

Postby pbs » Fri May 17, 2013 1:40 am

pbs
New php-forum User
New php-forum User
 
Posts: 39
Joined: Sat May 11, 2013 1:40 am
Location: Nashik, India

Re: How to print pdf report based on template?

Postby sandeep605085 » Fri May 17, 2013 3:51 am

Hi,

Try http://html2pdf.fr/en/default.

This is very useful to convert html templates to PDF.
You can define header,footer, page margins, page break and many other stuffs.

Thanks,
Sandeep Agrawal
Mindfire Solutions.
User avatar
sandeep605085
New php-forum User
New php-forum User
 
Posts: 44
Joined: Tue Feb 26, 2013 6:00 am
Location: Mindfire Solutions

Re: How to print pdf report based on template?

Postby marto » Wed Jun 05, 2013 7:12 am

Hi guys, thanks for your answers.

It's been quite a while from my last comment because I tried to use an hybrid solution, using the Java/PHP Bridge http://php-java-bridge.sourceforge.net/pjb/ which lets me use JasperReport technology.
This obviously requires to have a jvm and an application container running in addition to the web server, which I'd prefer to avoid, but for now this is the only feasable solution I found.

bps wrote:Try TCPDF

TCPDF is just a class to write out a PDF without having to output the actual pdf bytes, but it requires to explicitly accomodate contents on the page programmatically, it does not support use of some kind of template.

sandeep605085 wrote:Try http://html2pdf.fr/en/default

This is very interesting, most of all because it uses html as a template mechanism. Unfortunately, this way I'd have to write my own "engine" to fill the template with data.

Any other suggestions?
marto
New php-forum User
New php-forum User
 
Posts: 2
Joined: Fri May 17, 2013 12:13 am
Location: Italy


Return to PHP General

Who is online

Users browsing this forum: TurnitinBot [Bot] and 1 guest

Sponsored by Sitebuilder Web hosting and Traduzioni Italiano Rumeno and antispam for cPanel.