Skip navigation
Currently Being Moderated

Correct use of page-break-after

Mar 27, 2013 5:58 PM

Hello,

 

I'm sure this is a simple question for you.

I have LONG pages of stuff on the web for people to print out, and I'd like them to be able to print them out in a very specific way -

I want to decide when the page "breaks".

 

On the web I've seen straight-forward HTML, but also JAVASCRIPT solutions - and I'd like to keep the solution as simple as possible.

On this forum there are a few discussions of pagebreak, but no simple, definitive solution.

 

In your opinion, will the following work?

 

<html>

<head>

<style>

.breakhere {

    page-break-after: always;}

</style>

<body>

Page 1

Page 1

Page 1

Page 1

Page 1

Page 1

Page 1

Page 1

<div style="breakhere"></div>

Page 2

Page 2

Page 2

Page 2

Page 2

Page 2

Page 2

Page 2

<div style="breakhere"></div>

Page3

Page3

.

.

.

</body>

</html>

 
Replies
  • Currently Being Moderated
    Mar 27, 2013 6:35 PM   in reply to TimSPQR

    Have a look here http://css-discuss.incutio.com/wiki/Print_Stylesheets

     

    However the best solution for printing, is to use PDFs, that's what they are for. Create a PDF that has the same data. You have full control over the print format in that case. Have a look here http://www.fpdf.org/

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2013 8:38 PM   in reply to TimSPQR

    You are a fast learner!

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 28, 2013 9:53 AM   in reply to Ben Pleysier

    I have used fpdf in the page, and after getting over the startup quandries found it to be easy and reliable. It's a great way to generate a PDF on the fly.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 28, 2013 1:11 PM   in reply to TimSPQR

    Code looks good. Maybe your PHP installation on the server is not up to fpdf requirements? or maybe you didn't upload fpdf.php to the right location?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 28, 2013 3:25 PM   in reply to TimSPQR

    Upload a PHP file containing only this -

     

    <?php phpinfo(); ?>

     

    Browse to it.  What do you see?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 28, 2013 3:55 PM   in reply to TimSPQR

    Seeing PHP code in the source is the dead giveaway. This server isn't executing PHP. And yes, it's supposed to output a bunch of stuff about the PHP configuration, and server capabilities.  I'd speak with the host about this.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 28, 2013 4:24 PM   in reply to TimSPQR

    The fact that you're seeing a database folder makes me worry that you are looking at the wrong folder. What is the root directory that you have specified for the remote site?

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 28, 2013 10:47 PM   in reply to TimSPQR

    Why not not just create a pdf of the document and put a link to is so that they can download it to printout. That is what I do. It seems like a lot less work that what you are doing. Also I have control of what the PDF looks like. And on important aricles I have them translated into different languages (Russian, German, French, Croatian) so that the user can download them as PDF and print them out if they desire.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2013 5:34 AM   in reply to TimSPQR

    Did your phpinfo() file that you uploaded get named with a *.php extension? If not, try again.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2013 6:07 AM   in reply to TimSPQR

    Good luck!

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2013 6:15 AM   in reply to TimSPQR

    Then, given the fact that many people here use fpdf to make dynamic pdfs, I'll give that a try.

     

    I'm not sure that's accurate! One person suggested it, and another (me) said they had used it.... Not exactly 'many'.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2013 2:07 PM   in reply to TimSPQR

    Have a look at a few dynamically created PDF documents that I have utilised in the past http://pleysier.com.au/fpdf/

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2013 7:49 PM   in reply to TimSPQR

    It seems that your site has different type of content than mine (static) while from what you say yours is dynamic. Mine is more about feature articles. I'm not exactly sure what yours is about.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2013 9:13 PM   in reply to TimSPQR

    Your needs are very different from mine. I would go with the suggestions that the others made for you.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 30, 2013 5:05 AM   in reply to TimSPQR

    I think FPDF is ideal for this application, Tim.

     

    You need a search page, and a results page. The results page would create the PDF. Should be pretty straightforward.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points