View Full Version : Defining pagewidth

05-19-2010, 08:11 PM

I just made an iframe RTF editable by using some JavaScript, and a button to print the iframe's content. What I would like to know is if there is any way to specify an iframe's (or div's) width using CSS, so that line breaks occur on the same spot on the printed version as they do on the screen.

Pixels, %, em's and ex's all rely on the screen. But if I'd like to make the iframe fit for A4 paper (20x30cm), 20cm would seem huge on the screen, so does anyone know a solution?

I'd appreciate it.

05-20-2010, 12:16 AM
I have not done this, but if I were confronted with this problem, this is what I'd do:

Set up separate style sheets for screen and print. [There may be common parts that you could put in a third stylesheet for both screen and print, but lets ignore that part for now.]

In the print stylesheet set the font size and printable area to something that works for A4.

Create some test pages that use the full width of the page and print them using your newly created print stylesheet.

In the screen stylesheet set the font size you want to use on screen and set the width of the screen that is going to be used for your content.

View your test pages. Adjust the width of the content area until you get wrapping occurring in exactly the same place as on your printed pages.