Generating a PDF document

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
shwanky
Forum Commoner
Posts: 45
Joined: Thu Feb 15, 2007 1:21 am

Generating a PDF document

Post by shwanky »

I'm currently working on a project where I need to generate a pdf document. The document is a contract for my company and contains images and requires quite a bit of formating. I was wondering if anyone new of a good way I could go about achieving this goal. I thought about generating an HTML document and then using either fpdf or some other process to generate the pdf. But fpdf doesn't support HTML and CSS by default, correct me if I'm wrong. The other solution I thought of would be to manually create each object using fpdf but this seems a little bit complicated and rather annoying.

Any suggestions?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

There are 10 types of people in this world, those who understand binary and those who don't
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I'd suggest generating the document straight, in PDF, not HTML first. You may find ezpdf easier to understand and create your document in.
shwanky
Forum Commoner
Posts: 45
Joined: Thu Feb 15, 2007 1:21 am

Post by shwanky »

My server does not currently support PDFlib which is why I'm using fpdf.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Other than PDFLib, fpdf seems to be the most commonly suggested PDF library. Generating a PDF with the complexity you're describing will NOT be a trivial task. Get ready for some work.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
themurph
Forum Commoner
Posts: 76
Joined: Wed Apr 19, 2006 1:56 pm
Contact:

Post by themurph »

shwanky
Forum Commoner
Posts: 45
Joined: Thu Feb 15, 2007 1:21 am

Post by shwanky »

pickle wrote:Other than PDFLib, fpdf seems to be the most commonly suggested PDF library. Generating a PDF with the complexity you're describing will NOT be a trivial task. Get ready for some work.
WEE!!! I have a week XD
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

It's doable in a week if you dedicate that week to it. Well, to be honest it depends on how good one is at wrapping your mind around document formatting. You might find it quite easy to do. The most onerous part I found when using PDFLib was the absolute sizing & positioning of almost everything.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
shwanky
Forum Commoner
Posts: 45
Joined: Thu Feb 15, 2007 1:21 am

Post by shwanky »

pickle wrote:It's doable in a week if you dedicate that week to it. Well, to be honest it depends on how good one is at wrapping your mind around document formatting. You might find it quite easy to do. The most onerous part I found when using PDFLib was the absolute sizing & positioning of almost everything.
Ahh yah, thats the weakness in fpdf which I switching back to. There somethings it does that are alot easier than ezpdf which turns out to not be so easy ^.^... It has a lot of functions that make many redundant tasks simple, but some o fthe more complex things which I need to do are easier to do in fpdf... Its gonna be a long week! WEEEE!!! :D
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Can you illustrate some of these things which are harder for you to perform in ezpdf versus fpdf? I'm curious.
Post Reply