Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Printing Html

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a struts action / jsp that generates an HTML page that is intended to be printed and mailed to my company's clients.

On the screen it looks great. The page has background shaded divider bars with text overlaying them (silver background with black text) to separate parts of the page.

Unfortunately, when printed these background colors turn white.

Also, the browser prints headers and footers that are inappropriate to the final document.

Does anyone know of a way to get the browser to keep the background colors and suppress the header and footers?

Thanks,
Chris Elvart
 
Marshal
Posts: 25795
69
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If your browser is Internet Explorer then this option configures it that way: Tools, Internet Options, Advanced, Print background colors and images. I don't see an option in Firefox to do that.

(Edit: in Firefox, do Print Preview, then select Page Setup and the option is right there.)

And to prevent HTML elements from printing, you can use CSS like this:
[ June 21, 2006: Message edited by: Paul Clapham ]
 
Chris Elvart
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.

The print background option works well for me.

I already had css styles to suppress the printing of certain html elements.

What I want to suppress are the page headers and footers that IE puts on the page itself. These are the page title and "page # of #" at the top and the URL and date at the bottom.

Does anyone know how to suppress these?

Chris Elvart
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They are settings on the browser htat have to be removed manually. JavaScript can not touch them. Some ActiveX controls can change it, but it is activeX

Eric
 
And then the entire population worshiped me like unto a god. Well, me and this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic