Jump to content

Recommended Posts

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--
___________________________________

Link to comment
https://forums.phpfreaks.com/topic/235578-printer-friendly-w-footers-on-each-page/
Share on other sites

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.