calculating html table length in php to pdf conversion

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
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

calculating html table length in php to pdf conversion

Post by learnerabn »

Hi all,

I am working under a project.
it needs to convert html page to pdf file.
in that there is two tables and their fields are retrieved from the database.
so the height of the table is dynamic.
my doubt here is can i calculate that height of the table in php so that i can display the table header again if the table leads to the second page also?(though i know since php is server side scripting it is not aware of the browser's table length)
I can calculate the length using javascript or jquery but since i'm using html2pdf class file to convert the html page to pdf that class wont accept that script tags.

can any one help me?...

Any halp is appreciable.

Thanks in advance.
dejvos
Forum Contributor
Posts: 122
Joined: Tue Mar 10, 2009 8:40 am

Re: calculating html table length in php to pdf conversion

Post by dejvos »

On thing is advantage when you use a PDF ... the output looks always the same. So I think you can calculate length of a table by some oldschool calculation. It's a function like:

row-height*number_of_rows+(cell_padding_top+cell_padding_bottom)*number_of_rows+...

So I don't think, a function exists but it's not a big deal to write your own.
learnerabn
Forum Commoner
Posts: 48
Joined: Wed Feb 10, 2010 12:56 am

Re: calculating html table length in php to pdf conversion

Post by learnerabn »

Thanks for the reply.
On thing is advantage when you use a PDF ... the output looks always the same. So I think you can calculate length of a table by some oldschool calculation. It's a function like:

row-height*number_of_rows+(cell_padding_top+cell_padding_bottom)*number_of_rows+...

So I don't think, a function exists but it's not a big deal to write your own.
how can we calculate the row height here?
Since the content size of the row varies,the row height also varies.
Post Reply