Web Analytics Made Easy -
StatCounter Inserting pagebreaks at correct place - CodingForum

Announcement

Collapse
No announcement yet.

Inserting pagebreaks at correct place

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Inserting pagebreaks at correct place

    When building a report for the web in an asp file, using Javascript to create HTML lines, is there any way other than using a manual line count to determine where to place a page break and header coding? Since some of the data in the report comes from large text fields, or even ntext fields, in a SQL Server database, it is impossible to come up with an exact count of the numer of rows in a table, etc. Is there any way to determine in advance where the browser will break the page before it prints? Or can you suggest another method for printing reports from this database, so that multiple pages can have header information from the database?

  • #2
    I believe the <thead></thead> tags are meant to be used for defining the table row or rows that make up the heading and which should be reprinted on every page when printing a table.

    Have you made sure your markup uses those tags?

    Then you have to move your users to a browser which properly supports those tags (http://www.mozilla.org) because the Internet Exporer browser fails this test of simple html.

    I wish I could help more but IE is slightly worse than pathetic at printing while even the Mozilla browser only rates "poor".

    If you want extreme control on printed content from IE you'll have to buy an ActiveX plugin (there are some available) for your browsers (ok for intranet use but not good at all if you're going for internet users).
    Last edited by Roy Sinclair; Feb 25, 2004, 03:00 PM.
    Check out the Forum Search. It's the short path to getting great results from this forum.

    Comment


    • #3
      I really appreciate your reply. The users are entering data and printing reports on the internet, although the general public has no access to this website. So I guess ActiveX plugins are not an option. My colleagues would probably not be receptive to changing to Mozilla for our clients and ourselves, but your reply helped me to confirm that probably there is no easy way to do this. And that alone is a big help. I am considering a work-around involving changing the data entry form to cut the large ntext into page-size chunks. Then I can control the page breaks and headers, etc. Thanks again.

      Comment


      • #4
        You can control the page break in a web page by using the CSS property page-break-before and page-break-after. You have to put that property in the element where you exactly want to have page break in printing. But I don't think that javascript in any browser (and probably even in future web browsers) can automatically determine where exactly in the content the page will break without that CSS property. It depends on many factors such as: font size, paper size, orientation (Portrait/Landscape) and margins, in which javascript has no access. Maybe it's possible with ActiveX but as you said, it's not an option.
        Glenn
        vBulletin Mods That Rock!

        Comment


        • #5
          Considering the nature of what you're wanting to print you should perhaps think about loading the data into a PDF or a Spreadsheet and then let the user print either of those instead since both will give you the control that you lack using ordinary html.
          Check out the Forum Search. It's the short path to getting great results from this forum.

          Comment

          Working...
          X