Coffeehouse Thread

4 posts

Printing troubles in IE6

Back to Forum: Coffeehouse
  • User profile image

    OK, here's the situation.  I'm working on a thin-client app, so the user only has IE.  The app renders large images (think 1000x2000 pixels), sometimes rotated.  We are NOT using HTAs.

    To print, we pop up a new HTML document with just the image, and send that off to the printer.

    Now, as I mentioned above, the some pages may be rotated.  It's these I'm having trouble printing-- the aspect ratio keeps getting screwed.

    I don't know the size of the paper, so I can't scale against that.  The document sent to the printer seems to be scaled according initial window, not the target media.

    Here's a concrete example.  Let's say I have an image that's 2000 pixels wide and 1000 pixels tall.  Now, when I prepare my to-be-printed document, I have to scale the width of the image to fit the document-- 100% to maximize used space.  Now, I have a choice.  I can say "make the height 50%" (as that maintains the aspect ratio), but that means that the image will be half the height of the document / paper-- no good.  I can say, make it 500 pixels tall, which renders on the screen nicely, but on paper, it will be skewed, because the paper it's necessarily 1000 pixels wide.  Ah-hah, what about using an expression to set the height; surely that must work!  No.  The expression gets recalculated BEFORE the document is applied to the paper media, so it's just as before.

    What the hell am I supposed to do here?

    Agitated in Alameda

  • User profile image


    Sorry, but I'm really stuck, and I could really use some help with this.  Or a pointer to somewhere I might get a little help.  Smiley

    Also, if the problem's not clear, please say so, and I'll try to restate it.

    I can also provide some sample HTML, if that helps.


  • User profile image

    I THINK I understand what you're getting at, but just to be safe before we start assuming, can you just post a link to your app or the section that is doing the printing?


  • User profile image

    Let's give this a shot.  Hopefully Channel9 won't munge up the HTML too much.

    <DIV style="WIDTH: 100%; HEIGHT: 100%; BACKGROUND-COLOR: #ffffc0">
    <SPAN style="WIDTH: 100%; HEIGHT: 100%; POSITION: absolute;">
    <SPAN ID=FRAME style="WIDTH: 100%; HEIGHT:375px; POSITION: absolute;">
    <IMG style="WIDTH: 100%; HEIGHT: 100%; POSITION: absolute;" src="...">

    OK.  The image itself should be 1500 pixels wide by 750 pixels tall, for purposes of this example.  Give it a black border so you can clearly see what's going on.

    The fact that there's a DIV, SPAN, and another SPAN there is due to supporting code-- stuff which handles rendering markups, etc.  It expects a certain structure, and I can't toss that away.

    The SPAN ID'd as FRAME frames the image (duh?).  I can use this or the image style itself to control the size of the image. 

    If you fill in the image and try printing (at least with "letter"-sized paper-- 8.5" by 11"), the resulting image aspect ration will be skewed.  On screen, the image is 2:1.  On paper, it's more like 2.09677:1.

    If I specify 50% height for the FRAME span, then the image is stretched to 50% of the paper or window height.

    It's also worth noting that I have no control over the dimensions of the paper media-- it could be letter, but it could also be legal, or A4, or whathaveyou.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.