Stooney Posted May 5, 2011 Share Posted May 5, 2011 Say I need to print a 5 page document. The data on the document is dynamic (entered by a user) and will vary in size. At the bottom of every page, there needs to be a footer. How would I put all this together to where the data is cut off near the bottom of every page for a footer, and then continued onto a next page? paragraph 1.............. ................................... ................................... Page 1 paragraph 2................ ................................... ................................... ---Footer-- ___________________________________ paragraph 2 continued... .................................. Page 2 paragraph 3............... .................................. --Footer-- ___________________________________ Quote Link to comment https://forums.phpfreaks.com/topic/235578-printer-friendly-w-footers-on-each-page/ Share on other sites More sharing options...
cssfreakie Posted May 5, 2011 Share Posted May 5, 2011 have a look here: http://www.javascriptkit.com/dhtmltutors/pagebreak.shtml keyword is page break. Also in case you were not aware, you can make a special stylesheet for printing purposes. hope this helps in a way. Quote Link to comment https://forums.phpfreaks.com/topic/235578-printer-friendly-w-footers-on-each-page/#findComment-1210875 Share on other sites More sharing options...
Stooney Posted May 5, 2011 Author Share Posted May 5, 2011 That's fantastic. I'm surprised I didn't find this via Google last night. Thank You. One last hurdle now, any suggestions on how would go about determining where to insert page breaks dynamically? Like is there a way to measure how much of a page X text with take up so I can insert the page break in the middle of a paragraph if necessary to leave room for the footer? This might be more of a javascript question though. Quote Link to comment https://forums.phpfreaks.com/topic/235578-printer-friendly-w-footers-on-each-page/#findComment-1211082 Share on other sites More sharing options...
cssfreakie Posted May 5, 2011 Share Posted May 5, 2011 well I never tried that, but i bet both php and javascript have something that can see what the string length is and do something with that info. for php. for php strlen() could be something to have a look in: http://www.php.net/manual/en/function.strlen.php than make some sort of if clause, if strlen() is 1000 insert a pagebreak. just a brainfart, but that's how i would think when searching. Quote Link to comment https://forums.phpfreaks.com/topic/235578-printer-friendly-w-footers-on-each-page/#findComment-1211203 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.