473,725 Members | 2,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1681
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*****@hotmai l.com> wrote in message
news:11******** **************@ g43g2000cwa.goo glegroups.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*****@hotmai l.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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*****@hotmai l.com> wrote in message
news:11******** *************@g 43g2000cwa.goog legroups.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="printf n() 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.getEle mentById('print css').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="printf n() 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*****@hotmai l.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
2170
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 users. We have created all 20 logins in the new server (exact names) but when we restore the database I do not see the users anymore! Is there something we can do to preserve them or a script we can run to link
6
2995
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 the Select choices are lost. <A HREF="javascript:location='menu.jsp';window.open('menuhelp.jsp?menuID=5','me nuhelp',)">MenuTitle</A> I saw an example of a popup on a website that did not lose the menu choices.
6
1729
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 programming languages HTTP (any??) RPC (C, C++) ..NET (Microsoft)
198
11517
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 update/insert/delete statements and application B has 80-20 mix of select and update/insert/delete statements. Being able to scale the databases as needed so the performance is unaffected, is one of our critical requirements. We've been investigating...
1
1362
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 list, and can I tell what those choices are?
0
1728
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 perticular printer passing by user for printing pdf file i am using this code ,plz give me some idea how to print it with giving printer name
0
1710
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 have to get a monthly payment from the following choices which I have to use an array: - 7 year at 5.35% -15 year at 5.5% -30 yea at 5.75% I am currently reading about arrays, I figured I have to set a two-dimensional array, here is the code I have...
3
28468
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 http://ripalsoni.wordpress.com/2007/04/25/print-pdf-file-in-vbnet-by-giving-printer-name/ Dim pathToExecutable As String = "AcroRd32.exe" Dim sReport = "C:Test.PDF" 'Complete name/path of PDF file Dim SPrinter = "HP Officejet 5600 seriese" 'Name Of printer
6
1950
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, I thought if I put played around with the checked box function, I'd get what I want, but I don't. I tried changing this document.getElementById('markerImage').disabled = true; to this document.getElementById('markerImage').disabled =...
0
9401
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4519
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4784
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3228
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2637
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2157
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.