Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1871 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     HTML/XHTML/DHTML/CSS :

Force printing CSS background images

Thread title: Force printing CSS background images
Closed Thread    
    Thread tools Search this thread Display Modes  
03-29-2006, 09:25 PM
#1
jabberwocky is offline jabberwocky
jabberwocky's Avatar
Status: Member
Join date: Oct 2005
Location: Calgary, Alberta, Canada
Expertise:
Software:
 
Posts: 278
iTrader: 0 / 0%
 

jabberwocky is on a distinguished road

  Old  Force printing CSS background images

I came across this problem for my companies website. On the front page they have a javascript random image that changes with the page refresh. When you go to print this front page, the image, which is defined in CSS (as well as several other images) do not print UNLESS the user has selected an option to include the background images in their print.

So what I am looking to do, is that when an end user with unkown browser (most likely IE) prints the front page of the site, the random image, and the background images defined in CSS are printed as well.

I have been messing around with @media: print with little or no succes at the moment. I have read about using activex controlers but there are security issues there. Also, a possible generate PDF document on print, but if the end user DOESNT have it installed, thats a problem as well.

I don't want to get into any morality issues of "well the end user doesnt WANT to print the background image why force them?" or anything like that.

Any ideas on this?

03-29-2006, 09:29 PM
#2
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

Many (most) browsers don't bother printing background colours/images by default - don't force the user to go into the settings to change that option to the non-default one! Instead, how about modifying the way you do things so that a real image element is generated instead of a background image property? If it's just a page background, then I'd let the user make the decisions and you need to respect that.

PHP Documentation Team at php.net

03-29-2006, 11:43 PM
#3
jabberwocky is offline jabberwocky
jabberwocky's Avatar
Status: Member
Join date: Oct 2005
Location: Calgary, Alberta, Canada
Expertise:
Software:
 
Posts: 278
iTrader: 0 / 0%
 

jabberwocky is on a distinguished road

  Old

my list of 'work arounds' are growing, however they all seem to have limitations. the latest is;



style type="text/css" media="print">

#ti\tle {
display: list-item;
list-style-image: url(banner.jpg);
list-style-position: inside;
letter-spacing: -1000em;
font-size: 1pt;
color: #fff;
}
this would be used in say something like " <h1 id="title">hidden text</h1> "

really strange and only works in IE5.5+, FF1.0, etc.

04-07-2006, 04:13 PM
#4
jabberwocky is offline jabberwocky
jabberwocky's Avatar
Status: Member
Join date: Oct 2005
Location: Calgary, Alberta, Canada
Expertise:
Software:
 
Posts: 278
iTrader: 0 / 0%
 

jabberwocky is on a distinguished road

  Old

does anyone know if it is possible to only allow landscape printing through CSS? I found one bit of code for IE 5.5+ but nothing on the mozzila side.

IE code;


<style type="text/css" media="print">
div.page {
writing-mode: tb-rl;
height: 80%;
margin: 10% 0%;
}
</style>
info from

http://web.tampabay.rr.com/bmerkey/e...cape-test.html

so i have been trying to accomplish the same thing for mozila, but no luck so far. any ideas?

04-07-2006, 04:29 PM
#5
Bas is offline Bas
Status: I love this place
Join date: Jan 2005
Location: The Netherlands
Expertise: Frontend, vBulletin
Software: Coda, Photoshop
 
Posts: 607
iTrader: -1 / 0%
 

Bas is on a distinguished road

Send a message via MSN to Bas

  Old

Just put the same image ontop of the background image and hide it (with 'display: none' in CSS).
Then, in your print-CSS just change it to 'display: block'. Should work.

Or - if it's possible - change the background image to a normal image.

vBulletin Skins

04-07-2006, 05:04 PM
#6
jabberwocky is offline jabberwocky
jabberwocky's Avatar
Status: Member
Join date: Oct 2005
Location: Calgary, Alberta, Canada
Expertise:
Software:
 
Posts: 278
iTrader: 0 / 0%
 

jabberwocky is on a distinguished road

  Old

im not sure that will work for me. i have about 15 random images being placed in the dive tag (with each page refresh a new image apears), which is done with javascript. i figure i pretty much have to revamp my page, and remove some layer elements that are blocking me at the moment.

but the new issue im trying to figure out is the landscap printing. im pretty sure the answer is somewhere between @page and @print or something. just cant get it working yet for FF.

04-13-2006, 05:39 AM
#7
Garrett is offline Garrett
Status: Waving
Join date: Aug 2005
Location:
Expertise:
Software:
 
Posts: 2,694
iTrader: 11 / 100%
 

Garrett is on a distinguished road

Send a message via MSN to Garrett

  Old

<img src="<?php ?>" alt="" />
When its parsed, it will put the images/name.gif in there, find a random script and try that.

04-13-2006, 06:05 PM
#8
Jonny is offline Jonny
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
 
Posts: 335
iTrader: 0 / 0%
 

Jonny is on a distinguished road

  Old

Why not just have the random image as an image rather than a background? :P

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed