Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Generating PDF files with PHP

Creating dynamic pdf files



6:45 pm on Jan 4, 2007 (gmt 0)

10+ Year Member

Hi all,

I'm working on a project where I need to collect some user input via a webform and then generate a PDF file with that input.

The "output" needs to look like the company newsletter, with the headline formatted some graphics, etc. Can anyone tell me how php handles the formatting of a pdf? Do I just use html?



6:55 pm on Jan 4, 2007 (gmt 0)

5+ Year Member

You need to use a special library to generate a PDF, since the format is a complex one. If you have a budget to spend, you can buy a commercial product (these tend to be fuller in features) or download one of the few free libraries such as FPDF (which is more primitive and hence fiddly).

There are other complicating factors such as the embedding of fonts but the documentation for your chosen library will cover these.

Jordo needs a drink

7:22 pm on Jan 4, 2007 (gmt 0)

5+ Year Member

You could look here also... [us3.php.net...]


8:55 pm on Jan 4, 2007 (gmt 0)

WebmasterWorld Senior Member henry0 is a WebmasterWorld Top Contributor of All Time 10+ Year Member

This is what you You are looking for [fpdf.org]


9:05 pm on Jan 4, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member

HenryO suggested FPDF, which is what I use.

FDPF won't do things like rotated text or fancy effects. However, I have never needed that. I have a couple of sites that happily spew out beautiful PDF documents on demand.

Here [tecnick.com] is an extruded project. I have no idea how good it is.

If you like pears, there's an extension there [pear.php.net] that might be useful. I don't really use Pear that much, as it tends to be total overkill on the sites I build. However, it is a great system.


12:01 am on Jan 18, 2007 (gmt 0)

5+ Year Member

I use a non-module open source library. It is really easy to use. You can find it here [ros.co.nz]

Featured Threads

Hot Threads This Week

Hot Threads This Month