letter next page

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
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

letter next page

Post 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.
User avatar
m3mn0n
PHP Evangelist
Posts: 3548
Joined: Tue Aug 13, 2002 3:35 pm
Location: Calgary, Canada

Re: letter next page

Post 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.
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post 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?
User avatar
gurjit
Forum Contributor
Posts: 314
Joined: Thu May 15, 2003 11:53 am
Location: UK

Post 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.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post 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?
Post Reply