Click here to Skip to main content
15,878,852 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Well, I don't really know where to start...

I want to create a table with editable data (I have this data and it's input mechanism) in a pdf format for easier printing rather than creating an html document and converting it to a pdf format (due to its free flowing nature, if data inputted is too long, certain images are pushed to another page which is a problem for printing).

Seeing as fpdf does not have table support, do I need to just create a template using lines and then fill in the details? If so how?

Thanks for reading this!

Jordan

Edit: for some reason whenever I draw a line, it requires a line of text (I'm using $msg) before it otherwise it does not show up. Help?
Posted
Updated 3-Apr-17 3:56am
v2
Comments
Madbull12 14-Jun-12 6:58am    
Sorry, realised I was being stupid and forgetting to use specific code for fpdf :S
worked it out :D

OP commented that he solved the issue. Posting here just to pop it out of Unanswered list.
 
Share this answer
 
Making tables using FPDF for a pdf document is a common problem. Have a look at the easyTable project: GitHub - fpdf-easytable/fpdf-easytable: fpdf-easyTable is a PHP class that makes it easy to build tables for PDF documents generated with the FPDF library[^]

It is very easy to use:
$table=new easyTable($pdf, 3, 'border:1;');

// first row
$table->easyCell('Text 1', 'valign:T'); 
$table->easyCell('Text 2', 'bgcolor:#b3ccff;');
$table->easyCell('Text 3');
$table->printRow();

//second row
$table->rowStyle('min-height:20; align:{C}'); 
$table->easyCell('Text 4', 'colspan:3');
$table->printRow();

$table->endTable(4);

I hope my answer can help somebody.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900