Web Analytics Made Easy -
StatCounter Page Formatting When Printing - CodingForum


No announcement yet.

Page Formatting When Printing

  • Filter
  • Time
  • Show
Clear All
new posts

  • Page Formatting When Printing

    Hey Guys, so this question is actually in reference to a PHP script I have written to automatically generate invoices for a company. The problem though, is more of an HTML CSS thing,so I figured I would post it here.

    So the invoice format, is basically a collection of short paragraphs, with date on one side, then the amount of time billed and the dollar amount appearing on the right hand side of the paragraph. Each paragraph is a description of the services rendered. There is then a margin (or padding) between each entry. So the problem is this... if the invoice ends up being more than 1 page long (they generally are), there is no way to predict where the page break will occur (it could even be in the middle of a line). Can anyone think of a solution so I can actually print these invoices off, and make them look professional?

    This formatting has be racking my brain and I can't figure out a solution. Nothing that I have in my HTML\CSS "toolbox" can help me solve this problem. To work around it, I have even considered outputting the invoice as a CSV, opening it in Excel and printing it there.
    Last edited by JamesOxford; Aug 22, 2011, 08:05 PM.

  • #2
    You can control the print out using css.

    look here or google 'printing with css'

    Use these to jump around or read it all... I get a lot of questions asking if there are ways to "force" people's browsers to do certain things. The events

    Evolution - The non-random survival of random variants.
    Physics is actually atoms trying to understand themselves.


    • #3
      Thanks for your help. I quickly skimmed the links you gave me, and will read it a little closer later. The biggest problem is the page breaks, and there is no way to predict where they are going to be. I think if I want to do this it could require a JS solution, that compares where an element appears on a page in relation to the height of a piece of paper and the height of the element itself. If the entry is going to run over the page, we insert a page break.

      There was another piece of software called Price talked about in the Wiki article that could also work. So thanks for your help.