Page 1 of 1

letter next page

Posted: Thu Mar 18, 2004 4:31 am
by gurjit
hi all,

i am real stuck and need some advise.

i am coding some letter templates which will popup in a new window and bring up the print dialogue box for the user to print the letter when the user clicks a button on the website 'print letter'.

i need a method of finding out if the letters body text is one page or two pages long. the letters body text will be half static data and half dynamic data. thats why its impossible to know how the long the letters going to be.

if the letter is two pages long then i need to break off page 1 and begin printing on page 2. on page 2 i will need to reprint the header and footer with the remaining text for the body from page 1.

Re: letter next page

Posted: Thu Mar 18, 2004 4:49 am
by m3mn0n
gurjit wrote:the letters body text will be half static data and half dynamic data. thats why its impossible to know how the long the letters going to be.
Even if it's half static and half dynamic, it all comes together in one place eventually, right? So try counting the combined total lines within this unified hunk of text and that should help tell you how many pages it will be.

Posted: Thu Mar 18, 2004 4:50 am
by gurjit
i will be putting the text in a php template and developing tables in this template to display the data to be printed.

i was thinking if its possible may be if i could read the number of lines in the template and when i hit a certain number i cut off and put the footer, do a cutt off javascript to start printing on new page and pass the header, remaining text and footer to page 2.

or do you think i should take the text put it in a text file on the server read it and then allow printing?

how would i go about it?

Posted: Thu Mar 18, 2004 4:51 am
by gurjit
has anyone got any functions for counting the number of lines? cutting off at a certain point and pushing on to next page?

plus how do i do this. the template has html tables. do i count the lines of html and text? i need some guidance.

sorry to be a pain. i'm totally lost.

Posted: Thu Mar 18, 2004 5:46 am
by JAM
Your other post, but also perhaps in conjunction with [php_man]substr_count[/php_man] and [php_man]substr[/php_man] itself might work?