printing issue

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
aerish
Beginner
Beginner
Posts: 1
Joined: Wed Aug 20, 2003 3:53 pm

printing issue

Post by aerish »

we are using a DHTML vertical menu in left column of our page; when we print the web page, the DHTML menu prints in the middle, on top of the web page content... is there a way to correct this? we would like the menu either to print from its spot on the page, or not print at all, or print from a different spot on the page where it wouldn't block HTML text...

i have tried playing with screen position and menu placement, but to no avail

any advice is appreciated...
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I have a similar problem here when printing to an HP1200. The menu is in position, but severely twisted so as not to be readable. When I print the same page to an HP8500 it is perfect. The only solution I have is to try a different printer, as it seems to be a driver problem.

Sorry...
John
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

If you want to have the menu NOT print, then create a style (either on the page or in a css file like I do here):

Code: Select all

<!-- Styles for turning off things for print -->
.noprint{
	display: block;	}
.printonly{
	display: none;	}

@media print{
	.printonly{
		display: block;		}
	.noprint{
		display: none;		}
}
Then in your page, around where you include your scripts, put a div tag around them with the class set to noprint and it will hide the menu for print. See...

Code: Select all

<div class="noprint">
<SCRIPT language=JavaScript src="/inc/menu/milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="/menu_data.js" type=text/javascript></SCRIPT>
</div>
The browser should listen to the css, as mine did with IE 6. I use these noprint and printonly css styles to precisely control what gets shown and what gets printed. It makes my pages print a whole lot better! Good luck.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

Great bit detective work there Dave :D

Also, just to re-iterate printing and the menu. If you declare a style sheet of type media=print and then place this little snippet in the CSS file, it will do pretty much the same thing.

Code: Select all

.mmenu
{
	position:absolute;
	display:none;
}

Cheers
Andy
Marc-Andre.Roberge@mus.ul
Super Advanced
Super Advanced
Posts: 47
Joined: Sun May 19, 2002 7:23 pm
Location: Québec, QC, Canada
Contact:

Post by Marc-Andre.Roberge@mus.ul »

I have used Hergio's code to prevent my menu from being printed. What it does it to print the menu entries without the darker background. This is OK with me, but there is curiously a big backslash covering the entire height of the menu bar being printed at the very left. I am using an HP LaserJet 2200D. Is this a bug in the menu? This happens with both version 3.5 and version 5.
AndrewRoazen
Beginner
Beginner
Posts: 3
Joined: Fri Aug 29, 2003 7:20 pm
Location: Arizona
Contact:

Post by AndrewRoazen »

BTW, you want to use the LINK tag syntax for referring to your hidemenus.css to ensure NN4 respects it:

Code: Select all

<link href="hidemenus.css" rel="stylesheet" media="print" type="text/css" />
A funny bug in NN4 has resulted in our homepage being print rendered as a blank sheet (in NN4) unless this line is added.
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

I understand adding no print to the style sheet.
What is Andy saying Media=Print?
Where does that go? At the top of each menu data?

Thanks
maz
AndrewRoazen
Beginner
Beginner
Posts: 3
Joined: Fri Aug 29, 2003 7:20 pm
Location: Arizona
Contact:

Post by AndrewRoazen »

What he means is, take the CSS code he was showing, save it as print.css and then link to it in your HTML the way I demonstrated. Nothing changes in your .js files.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Max by linking the way Andrew mentioned (with the media=print) it basically tells the page that when its about the be printed, use these styles instead of the regular ones. It allows you to have a page print differently then viewed on screen. If you prefer not to link your style sheets, and do them inline on the page (in the head) you specify which style properties to use when printing using my method described above.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Oh, so Andys method is to change the page styles on print, if I want to keep the page layout styles I should use your method.

That's a Mazzzzz Raz Ma' Taz and all that jazz. :D
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

no both of our ways will change it for print...it just a matter of where do you want to specify the style. In an included file or defining in the page. My option used a div tag around the menu to hide it, thats before I knew that we could reference the .mmenu class and override it for print. But you can either include the style in a CSS or inline in the page.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Okay, must go back to Andys suggestion again, for some reason my page is starting after the menu in IE 5.1.6, I thought it was when I added the radio button, had a lot of problems getting it right, then I put followscroll back in, but it could be the div tag on a mac.

Thanks for reminding me.
maz
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

I'm sure you know this, maz, but do one change at a time. With multiples, if (when) something goes wrong, it's a lot tougher figuring out the cause.

Remember - Murphy lives :!:
John
trevc
Beginner
Beginner
Posts: 9
Joined: Thu Jan 29, 2004 9:55 pm

I.E. 6 sp 1 issue?

Post by trevc »

I've got the styles"

#menu0 {display: none;}
.mmenu {position:absolute; display:none; }

in a stylesheet (media = print).

In preview the menu is gone, but when the paper comes out the printer, the content in the place where the menu cascades out to is blank.

Using the same page in Mozilla 1.5/1.6 works FINE. Bug in I.E. 6? Anyone else having the same issue? Workaround?

thanks
./tc
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

It's a little tough without seeing the actual code setup, but I think that should work.

What you're trying is close to the article at http://www.macromedia.com/devnet/mx/dre ... print.html. Maybe that will help.
John
Post Reply