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)

Full Member

10+ Year Member

joined:Nov 19, 2003
votes: 0

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)

Junior Member

5+ Year Member

joined:July 18, 2006
votes: 0

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.

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

Full Member

10+ Year Member

joined:Jan 14, 2006
votes: 0

You could look here also... [us3.php.net...]
8:55 pm on Jan 4, 2007 (gmt 0)

Senior Member from US 

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

joined:Apr 19, 2003
votes: 2

This is what you You are looking for [fpdf.org]
9:05 pm on Jan 4, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Feb 21, 2005
votes: 0

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)

New User

5+ Year Member

joined:Feb 16, 2006
votes: 0

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

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members