Unwanted margins while printing a full 8.5x11in page. Why?


  • I got this CSS

    <style type="text/css"}
      position: absolute;
      top: 0;
      left: 0;
      width: 8.5in;
      height: 11in;
      margin: 0;
      border: 0;
      padding: 0;

    And only this HTML in the body

    <img id="image" src="image.jpg"/>

    *image.jpg is 8.5x11 inches itself

    Went to the registry in
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup

    and set these values to zero (0):


    (This last step in the registry is because I cannot put those values to 0 in the Page Setup dialog, no matter what I put I always get something greater that 0, hence a forced margin value I don't want.)

    The Problem: As you see, I intent to print a full 8.5x11 inches image. In the print preview it appears fine, but when I print it, I always get white margins in the 4 borders!!!
    I tried many, many different printers, even a pdf printer, always the same result.

    Where do those margins come from? My CSS is pretty clear stating that the image selector is 8.5x11 inches, starting at top 0,0. I can even preview it correctly!!

    And by the way, why can't I set IE margins to 0 without going to the registry?

    Any ideas.


    Saturday, June 09, 2007 7:42 AM

All replies

  • also add CSS for the html/body tags.  By default they have a padding/margin.

    html, body {

    Also note that many printers cant print right to the edge, as they need space to hold the paper...

    Good Luck!
    Thursday, June 28, 2007 9:01 PM
  • Didn't do. I tried that but the problem seems to be with the margins in IE browser.


    For instance, I can have the body of the page to show a blue background. If I open it within a browser everything looks OK, but if I go to "Print Preview" I'll get the nasty margins (white color by default so that's how I know they're not mine).


    If I try to lower the margins to 0 (zero) the browser will adjust them to some number, but never zero.


    The only way I can manage the print preview (and later print) to work, is setting the margins to zero in the registry in


    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup


    where thse values are the none to set to zero:

    • margin_bottom
    • margin_left
    • margin_right
    • margin_top


    I even made the page 8in times 11in (8x10) and made the sylesheet centered, but the margins are appended anyway.


    This is driving me crazy

    Tuesday, July 03, 2007 1:11 AM
  • Sorry, a foolish idea:
    Have you cleaned the header/footer settings in the registry too?
    Tuesday, July 24, 2007 10:32 AM
  • Header and Footer in the registry hold the same information you can set in the "Page Setup" menu, i.e., plain text, URLs, date and time etc.


    Unless you mean a different setting than the one I'm taking about.



    Thanks for the idea anyway

    Tuesday, July 24, 2007 9:28 PM
  • Hi,
    I tried to think logically - if the header/footer are set to some value (can it be a whitespace too?), the IE will reserve the place for them...
    The other idea: the difference between physical paper size in the printer and your programmable page size can cause the margins (e.g. US Letter and A4).
    Probably you've checked it previously, in this case I bag your pardon.

    Oh, the newest idea:
    Does the IE support the page settings, such as margins? If they are the feature of CSS2?
    Here we have an opened question - the settings in CSS and registry together. Which one is a stronger?
    I have similar problem with the page orientation (I've opened a separate thread for it)
    Sorry once more:
    I can't answer youe question, but make a new and new ones...

    Wednesday, July 25, 2007 7:18 AM
  • Don't worry, any ideas are welcome.


    The thing is, Header and Footer I already played with, no luck ...


    If you play with the 4 margin values in the registry and set them to 0, you won't get margins while printing and that's what I want.


    The problem, well very simple, I cannot manipulate every user's registry form the Web, nor should I.


    My goal is to provide reliable printing capabilities from my web site to IE users, but as you see, those margins are way off control.


    Finally, CSS2 and IE? There's still a long way to go before you can trust CSS2 in IE. They claim to have close the gap, but if you play a while with CSS2 and IE7, you'll realize the truth.



    Thanks again.

    Wednesday, July 25, 2007 11:57 PM
  • Hi,
    Probably now I have an answer to your problem:
    In normal case the printer settings contain a safety strip (about 5 mm) as a margin all-around the page.
    It was done in order to prevent the innen parts of the printer from a dirt.
    It is possible to set another value using the printer panel, for example, on Lexmark: print area -> whole page/normal.
    The printer's manufacturers don't like this option...
    Have a nice day (me too)....
    Thursday, August 02, 2007 1:42 PM
  • I was trying to find the "print area" option but don't know where to find it.


    Can you point me out? I have a Lexmark too, this may help




    Thursday, August 02, 2007 4:53 PM
  • OK,
    next week I send the "instruction", today I work at home, havn't access to this printer.

    Next week:
    Lexmark Optra K1220:

    MENU --> SETUP MENU --> PRINT AREA --> Whole Page

    For some kinds of printers such setting can be hidden (entering of a special sign sequence etc.)

    Friday, August 03, 2007 1:02 PM