473,385 Members | 1,379 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Giving choices to users in print CSS?

How hard (and desireable) would it be to give the user certain choices when
it comes to printing web pages?

The pages on my site use colours and pictures and contain an imbedded menu,
among other things. Now, I could make certain assumptions on the user's
behalf, such as making the background white and the text black, suppressing
the menu from the printed page, and even suppressing the printing of the
pictures if they are merely decorative rather than functional. But that
might not please visitors who WANT some or all of those things.

Therefore, I'd like to know how hard it would be to give the user choices
when they click the Print (or Print Preview) buttons in their browser. For
instance, I could see a dialog like this appearing (I'll use "[]" to mean a
checkbox and "()" to mean a button):

----------------------------------------------------------------------------
-----------------------------------
1. [] print in same colours as the screen (if the box is unchecked, you will
get black text on white background)
2. [] print graphics that are strictly decorative (if the box is unchecked,
strictly decorative images will not be printed)
3. [] print the menu (if the box is unchecked, the menu will not be printed)

Check the appropriate boxes (if any), then click the Print button.

(Print) (Cancel)
----------------------------------------------------------------------------
-------------------------------------

The problem is that I'm not at all sure how I'd make that dialog appear or
how I would dynamically change the behaviour of the CSS based on the
selections the user made.

JavaScript might come in handy here but I know JavaScript is not considered
a good solution because of browser compatibility issues. I could make all of
my webpages Java applets but I know some people are notoriously reluctant to
install Java plugins in their browsers.

Is there a reasonable way to give the users choice or am I pretty much
forced to make the decisions for them? (Naturally, if I have to make the
decisions for them, I'm going to bend over backwards not to antagonize them
by printing black text on white and suppressing all but the most essential
information. Users who wanted their hard copies to match the screen will
just have to live with my choices.)

I'm basically a programmer and I try very hard to design programs so that
they give the user exactly what they want. Forcing everyone to live with my
choices of what will appear on the printed page and how it will appear
really goes against the grain....

--
Rhino
Nov 23 '05 #1
9 1667
Rhino wrote:
Therefore, I'd like to know how hard it would be to give the user choices
when they click the Print (or Print Preview) buttons in their browser.


I don't think you can do that.

Most browsers allow the user to set certain print options like whether
or not to print the page's background, so you could decide not to touch
the background in your print styles. But do you expect people to insist
on having a blue background printed? In that case, they can always make
a screenshot and print that :)

I guess you could also make an alternate (print) stylesheet which the
user could select, but browser support for that is scanty.

--
Garmt de Vries.

Nov 23 '05 #2
Rhino wrote:
Therefore, I'd like to know how hard it would be to give the user choices
when they click the Print (or Print Preview) buttons in their browser.


I don't think you can do that.

Most browsers allow the user to set certain print options like whether
or not to print the page's background, so you could decide not to touch
the background in your print styles. But do you expect people to insist
on having a blue background printed? In that case, they can always make
a screenshot and print that :)

I guess you could also make an alternate (print) stylesheet which the
user could select, but browser support for that is poor.

--
Garmt de Vries.

Nov 23 '05 #3

"Garmt de Vries" <gd*****@hotmail.com> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...
Rhino wrote:
Therefore, I'd like to know how hard it would be to give the user choices when they click the Print (or Print Preview) buttons in their browser.
I don't think you can do that.

Most browsers allow the user to set certain print options like whether
or not to print the page's background, so you could decide not to touch
the background in your print styles.


"No" is pretty much the answer I expected to get to my question ;-)

Still, it seemed worth asking in case a good technique for giving users
choices had emerged since I last dabbled with CSS.
But do you expect people to insist
on having a blue background printed?
I know that's not something that a huge percentage of people would want to
do but it seems like something that *some* people might want to do. I
certainly like the printed page to look just like the page they see on the
screen; only the relatively high cost of ink deters me from printing
coloured backgrounds and large colour pictures, especially those with dark
backgrounds.

But surely some people would have the attitude that they would prefer the
printed page to match what they see on the screen, even if it costs more.
That's why I'd like to be able to accomodate *both* kinds of users.
In that case, they can always make
a screenshot and print that :)
Granted. But many users are not sophisticated enough to know about
screenshot utilities; in fact, many probably wouldn't know where to find one
or how to install it even if someone told them they needed one. Also, some
people might not be authorized to install a program if it is a PC that they
are using at work.
I guess you could also make an alternate (print) stylesheet which the
user could select, but browser support for that is scanty.

Well, if the technique is only going to work on a few obscure browsers that
the vast majority of people are not going to have, then there's not much
point in doing it in the first place.

I'll just have to make the choices for the user and hope that, eventually,
CSS and browsers evolve to the point where some method of user selection of
print options is routine.

Thanks for confirming my suspicions that giving users control over printing
is not really practical, except at the general browser setting level.

Rhino
Nov 23 '05 #4

Rhino wrote:
I know that's not something that a huge percentage of people would want to
do but it seems like something that *some* people might want to do. I
certainly like the printed page to look just like the page they see on the
screen; only the relatively high cost of ink deters me from printing
coloured backgrounds and large colour pictures, especially those with dark
backgrounds.

But surely some people would have the attitude that they would prefer the
printed page to match what they see on the screen, even if it costs more.
That's why I'd like to be able to accomodate *both* kinds of users.


Don't forget that CSS is only a suggestion of how the page could look.
The user always has the option to ignore your print stylesheet if they
prefer to do so!

--
Garmt de Vries.

Nov 23 '05 #5

"Garmt de Vries" <gd*****@hotmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...

Rhino wrote:
I know that's not something that a huge percentage of people would want to do but it seems like something that *some* people might want to do. I
certainly like the printed page to look just like the page they see on the screen; only the relatively high cost of ink deters me from printing
coloured backgrounds and large colour pictures, especially those with dark backgrounds.

But surely some people would have the attitude that they would prefer the printed page to match what they see on the screen, even if it costs more. That's why I'd like to be able to accomodate *both* kinds of users.


Don't forget that CSS is only a suggestion of how the page could look.
The user always has the option to ignore your print stylesheet if they
prefer to do so!

Really? This is the first time I've heard that....

How would the user indicate that they want to ignore the CSS?

What rules would be applied to formatting the HTML page if the user elected
to ignore the CSS?

Rhino
Nov 23 '05 #6
Rhino wrote:
"Garmt de Vries" <gd*****@hotmail.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
Don't forget that CSS is only a suggestion of how the page could
look. The user always has the option to ignore your print stylesheet
if they prefer to do so!
Really? This is the first time I've heard that....

How would the user indicate that they want to ignore the CSS?


http://k75s.home.att.net/show/sfl-3.jpg :-0
What rules would be applied to formatting the HTML page if the user
elected to ignore the CSS?


HTML code only.

--
-bts
-Warning: I brake for lawn deer
Nov 23 '05 #7
Rhino,
I don't see why you can't implement your options using Javascript.

I was also a programmer in a past life (now retired) but I only have
about one year of using the web (on my home PC), i.e. HTML CSS and JS

But I am thinking:
Can't you get JS to write the CSS you want based on the user's choice?

My thoughts:

Insert a named <div> in your HTML:
<div id ="printcss"></div>

Then add a print button somewhere lower down
<button onclick="printfn() value="Print this document"></button>

In printfn(), you ask various questions (using prompt) and use the
returned answers to set up the "whatever" in the body style below

var whatever
document.getElementById('printcss').innerHTML=
'<style type = "text/css"> body{'
+ whatever
+ '}</style>'
print()

I haven't done any testing at all. These are just ideas off the top of
my head. I don't know whether writing a new style into the document
immediately before printing will work. But why wouldn't it ?

I'd be interested to know whether you try this idea and if so, have any
success

Nov 23 '05 #8

Trevor L. wrote:
Insert a named <div> in your HTML:
<div id ="printcss"></div>

Then add a print button somewhere lower down
<button onclick="printfn() value="Print this document"></button>

In printfn(), you ask various questions (using prompt) and use the
returned answers to set up the "whatever" in the body style below


This may work, but it won't be correct. The <style> is supposed to go
in the <head> section. Even if you use JS to put some new CSS in the
<head>, I, as a user, would be rather annoyed if you forced me to go
through a series of questions every time I wanted to print a page from
your site.

--
Garmt de Vries.

Nov 23 '05 #9
> "Garmt de Vries" <gd*****@hotmail.com> wrote in message
Don't forget that CSS is only a suggestion of how the page could look.
The user always has the option to ignore your print stylesheet if they
prefer to do so!

Rhino wrote: Really? This is the first time I've heard that....
Read about cascading in the CSS specs.
How would the user indicate that they want to ignore the CSS?
Depends on the user agent (brower).
What rules would be applied to formatting the HTML page if the user elected
to ignore the CSS?


user agent "CSS"

--
Johannes Koch
In te domine speravi; non confundar in aeternum.
(Te Deum, 4th cent.)
Nov 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SD | last post by:
Hi, Quick question, I have about 20 users in my local server and database. We are looking to restore that database to a new server in a new network and still be able to retain the database...
6
by: Mica Cooper | last post by:
Hi, I have a series of Select menus on a page. I am trying to allow the user to click on the Select title and have it popup a help window. This works fine with the following code except that all...
6
by: apngss | last post by:
When an application needs to get information from another machine over the network, how many distributed computing choices out there? Here are the choices I know of, classifying by different...
198
by: Sy Borg | last post by:
Hello: We are designing two multi-user client server applications that performs large number of transactions on database servers. On an average Application A has a 50% mix of select and...
1
by: John Baker | last post by:
Suppose I am exploring an unknown form programatically through VBA, and I have run across a control I have determined is a combo box. Is there a way to tell if the combo choices are restricted to...
0
by: ripal.soni | last post by:
Hi there I am .net developer ,right now working on a project in that i need to print pdf file using vb.net and i also have to pass printer name as argument ,file should be printed on a...
0
by: cameron | last post by:
Hi everyone, I am in the process of writing my last program for my Introduction to C++ class. I have to write a program what will allow a end user to input an amount of a mortgage, from there, I...
3
by: ripal.soni | last post by:
To Print file on your selected printer instead of default printer you can write the following code also you can find the complete solution in...
6
tpgames
by: tpgames | last post by:
I'm trying to get a maze to default to always giving me the image as the marker and never give me the color as the marker. The code requires you to check a box to get the image marker to be used. So,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.