Go Back  HTML Forums - Free Webmaster Forums and Help Forums > WEBSITE DEVELOPMENT > Client Side Scripting
User Name:
Password:
 

Reply
Thread Tools   Display Modes
  View First Unread
 
Old 02-08-2001, 04:21 AM
  #1
achugh
Novice (Level 1)
 
Join Date: Feb 2001
Posts: 4
iTrader: (0)
achugh is on a distinguished road
I am working on a project in which I can not use any component. And I have to send a HTML report to the browser which can easily be printed at the client end. The report needs to have a page header & footer on every page.

PROBLEM: How to get the client's page settings, set in the browser, Or how to override the browser page settings so that the formatting done at the server end should not be spoiled. I am using ASP at the server end. The solution should be compatible with IE4.0 and NN4.0 .

PLEASE. HELP!!!!!!!!!!!!

achugh is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-08-2001, 09:17 PM
  #2
Dr. Web
Super Virtual Guru
 
Dr. Web's Avatar
 
Join Date: Jan 2001
Location: Colorado, USA
Posts: 5,573
iTrader: (0)
Dr. Web is on a distinguished road
Post

without getting too complicated...this will work
<A HREF="javascript:window.print()">Click to Print This Page</A>
Dr. Web is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-09-2001, 12:47 AM
  #3
achugh
Novice (Level 1)
 
Join Date: Feb 2001
Posts: 4
iTrader: (0)
achugh is on a distinguished road
Question

Thank you Dr. Web but I think I didn' get the answer.

My problem is how to get the page layout & margin at the client's end using JavaScript. Or What I need is "Scripting Support for Web Page Printing?" that should work for both IE4.0 & NN4.0 without using any components.

When I invoke "window.print()" The printed page has "Header's & Footer's" defined in the browser Print setup printed on the page (like, URL, date, Page number) which I don't want to be printed. Also I would like to know the default Page settings of the browser so that I should format my report according (at the server end) and when the user click on "window.print()" the printed page should not be clipped or divided into two pages at the client end which I have formated for a single page.

PLEASE ADVICE!!!!!!!!!!!!
achugh is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-09-2001, 04:07 AM
  #4
Ian
Sheriff (Almighty)
 
Ian's Avatar
 
Join Date: Nov 1999
Location: Chch New Zealand God Mode: On
Posts: 3,167
iTrader: (0)
Ian is on a distinguished road
Hi, check out a great article on 123webmaster about printing pages from the net http://www.123webmaster.com/Articles/cssprint.html
it uses css to specify what you want to print on your page, well worth the look !! If this is not what you mean, please let us know. thanks.
__________________
Ian
Ian is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-09-2001, 05:05 AM
  #5
achugh
Novice (Level 1)
 
Join Date: Feb 2001
Posts: 4
iTrader: (0)
achugh is on a distinguished road
Thank you Ian. But I am sorry to say that the problem still lies there.

FIRST and the formeost important thing is that I want a solution which should be compatible with both IE4.0 & NN4.0 .

Secondly, I need to print an HTML page which is formatted using <TABLE> tag through a web browser. When the page is printed every page should have a common Header.

Going through the Microsoft documentation I found that <THEAD> tag is actually meant for this functionality. This Tag is introduced in HTML 4.0 by W3C. But microsoft claims this as a bug in IE.

You can find the information regarding this BUg at microsoft. Just search for "BUG: THEAD and TFOOTER Text Is Not Printed on Each Page" or Search for "ID: Q190278" MoreOver Netscape does not support this too.

Thirdly, about using CSS. The new CSS 2 specification says that you can use @page to deine a page box. Define the page margins and page breaks with "page-break" etc. But again this new CSS specification is only supported by IE5 & above. Lot of sites are using this CSS2 spec to define a page break. Although microsoft does not still provide page margins and page orientation styles as proposed by CSS 2 specification in it's IE5.5

The "window.print()" is also not supported in IE4.x . Microsoft has given this support in IE5.0 & above although NN4.0 has it.

I think I must have made my point clear what I really want.

I REALLY NEED HELP!!!!!!!!!!!! PLEASE.........
achugh is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-09-2001, 09:19 AM
  #6
Ian
Sheriff (Almighty)
 
Ian's Avatar
 
Join Date: Nov 1999
Location: Chch New Zealand God Mode: On
Posts: 3,167
iTrader: (0)
Ian is on a distinguished road
Sorry that was of no help to you. Ever thought some things just can't be done ?? maybe you need to go client side for this and use a .cgi or vb application.
__________________
Ian
Ian is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-09-2001, 11:00 PM
  #7
achugh
Novice (Level 1)
 
Join Date: Feb 2001
Posts: 4
iTrader: (0)
achugh is on a distinguished road
Thank you Ian.
achugh is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-14-2001, 04:06 AM
  #8
Syst3m Err0r
Hero (Level 10)
 
Syst3m Err0r's Avatar
 
Join Date: Jan 2001
Location: Soest, Utrecht, the Netherlands
Posts: 92
iTrader: (0)
Syst3m Err0r is on a distinguished road
This might not solve everything that you want (you might want the impossible), but this one works with NN...

<script language="JavaScript">
<!--
function custom_print() {
if (document.all) {
if (navigator.appVersion.indexOf("5.0") == -1) {
var OLECMDID_PRINT = 6;
var OLECMDEXECOPT_DONTPROMPTUSER = 2;
var OLECMDEXECOPT_PROMPTUSER = 1;
var WebBrowser = "<OBJECT ID=\"WebBrowser1\" WIDTH=0 HEIGHT=0 CLASSID=\"CLSID:8856F961-340A-11D0-A96B-00C04FD705A2\"></OBJECT>";
document.body.insertAdjacentHTML("beforeEnd", WebBrowser);
WebBrowser1.ExecWB(6, 2);
WebBrowser1.outerHTML = "";
} else {
self.print();
}
} else {
self.print();
}
}
//-->
</script>

greets,

Syst3m Err0r
Syst3m Err0r is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-16-2001, 07:10 AM
  #9
saibal
Novice (Level 1)
 
Join Date: Feb 2001
Location: rome
Posts: 1
iTrader: (0)
saibal is on a distinguished road
hi,
i have a problem: i have a frameset and i put the JS to print in frame 1. is it possibile to print the frame 2 when the button is in the first frame?

thank you
saibal is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-16-2001, 10:45 AM
  #10
Syst3m Err0r
Hero (Level 10)
 
Syst3m Err0r's Avatar
 
Join Date: Jan 2001
Location: Soest, Utrecht, the Netherlands
Posts: 92
iTrader: (0)
Syst3m Err0r is on a distinguished road
Thats up to the users browser/printer configuration.
Under IE you can set in the advanced options menu under [tools] > [ Preferences] things like 'print background images/colors' and at when pressed on the link, you'll get a printer options menu where you can choose weather you want to print one frame or al frames (ind. or like layout) but that's all up to the visitor. (It's exactly the same as [file] > [Print] or when you pudh on the printer icon.)

greetz,

Syst3m Err0r

[Edited by Syst3m Err0r on 02-16-2001 at 11:50 AM]
Syst3m Err0r is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-16-2001, 01:54 PM
  #11
Jason
1.21 Gigawatts
 
Jason's Avatar
 
Join Date: Nov 1999
Location: Hill Valley
Posts: 4,812
iTrader: (0)
Jason has a spectacular aura aboutJason has a spectacular aura aboutJason has a spectacular aura about
Quote:
Originally posted by Ian
...maybe you need to go client side for this and use a .cgi or vb application.
Hey Ian, did you mean to say server side for this?
Jason is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 02-16-2001, 02:22 PM
  #12
Ian
Sheriff (Almighty)
 
Ian's Avatar
 
Join Date: Nov 1999
Location: Chch New Zealand God Mode: On
Posts: 3,167
iTrader: (0)
Ian is on a distinguished road
yip, made a boo boo, must have been one of those late night replys, sure you know what I'm taking about. Sorry.
__________________
Ian
Ian is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 04-23-2001, 03:04 AM
  #13
Unregistered
 
Posts: n/a
Quote:
Originally posted by saibal
hi,
i have a problem: i have a frameset and i put the JS to print in frame 1. is it possibile to print the frame 2 when the button is in the first frame?

thank you
  Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-31-2001, 06:13 AM
  #14
skykrishna
Novice (Level 1)
 
Join Date: Oct 2001
Location: INDIA
Posts: 1
iTrader: (0)
skykrishna is on a distinguished road
Unhappy add header or remove the option

hi there,
even i have the same problem,pls guide me if u know any alternative or way to solve this.it would be greatful.

thanx in advance
Krishna
skykrishna is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Old 10-31-2001, 06:35 PM
  #15
Jon Hanlon
Super Guru (Moderator)
 
Jon Hanlon's Avatar
 
Join Date: Jul 2001
Location: Sydney, Australia
Posts: 1,852
iTrader: (0)
Jon Hanlon will become famous soon enough
There are some things that just can't be done - and this is one of them. Printing support is minimal in IE4 and NN4 - IE4 doesn't even have a print() method (although you can emulate it). What you can't do, however, is take charge of the user's printer and change margins, heading & footers, or print without their knowledge. This is to stop retail stores printing their entire catalog out on your printer when you navigate to their site, or putting an advertisement in your header.

If this is for an intranet, you could look at http://msdn.microsoft.com/library/de...l/wb_print.asp for some hints.
Also, see http://msdn.microsoft.com/library/de...dhtmlprint.asp as well.

If you can limit your audience to IE5.5+, you can use print templates. See http://www.webreference.com/js/column89/ for a tutorial.

To print another frame, do
<input type='button' onclick='parent.frames.OTHER_FRAME_NAME.print()'>
It won't achieve much though, as the user will still be prompted for which frame they want to print.
__________________
Jon Hanlon
Jon Hanlon is offline   Add to del.icio.us Add to del.icio.us    Can you digg it?Can you digg it? Reply With Quote
Reply
KEEP TABS
SPONSORS
 
Boxedart

 
 


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



 
  POSTING RULES
 
 
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Thread Tools
Display Modes

Forum Jump

 

All times are GMT -5. The time now is 05:44 AM.

   

Mascot team created by Drawshop.com

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Server Monitoring by ENIACmonitor 0.01
HTMLforums.com © Big Resources, Inc. Web Design by BoxedArt.com
vRewrite 1.5 beta SEOed URLs completed by Tech Help Forum and Chalo Na.