SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Mar 2014
    0 Post(s)
    0 Thread(s)

    Printing web documents

    Hello everyone.
    I have a page that I need to add a header to, a footer, paper sizes as legal, etc and every other print formatting properties. Pleas how can I do this to a html page. I have completed the design and everything needed but i cant prepare it for printing as the client required. Thanks.

  2. #2
    SitePoint Mentor silver trophybronze trophy
    Mikl's Avatar
    Join Date
    Dec 2011
    Edinburgh, Scotland
    63 Post(s)
    0 Thread(s)
    Create a separate style sheet for printing as opposed to screen display. Use this style sheet to control things like page margins, width of printable area, and other factors that only apply to the printed version. You could also use it to hide on-screen navigation and other items that you don't need on the printed page.

    Then, in your HTML, select the style sheet, possibly using code similar to the following:
    <link rel="stylesheet" type="text/css" href="screen.css" media = "screen" />
    <link rel="stylesheet" type="text/css" href="print.css"  media="print" />
    But keep in mind that with HTML you can't really control the layout of the printed page. You don't know what paper size the user has selected, what zoom factor they are applying to the printed version, what fonts they have installed, and several other factors. If you really want total control over the printed page, the best approach is to generate a PDF - but even that's not perfect.



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts