|
 |
asp_web_howto thread: Printable Version?
Message #1 by jprentice@e... on Fri, 24 Aug 2001 17:25:33
|
|
How does one create a printable version of a web page in ASP???
Message #2 by "Drew, Ron" <RDrew@B...> on Fri, 24 Aug 2001 12:23:37 -0400
|
|
Add to the body...
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (window.print) {
document.write('<form>Press to '
+ '<input type=button name=print value="Print" '
+ 'onClick="javascript:window.print()"> this page!</form>');
}
// End -->
</script>
-----Original Message-----
From: jprentice@e... [mailto:jprentice@e...]
Sent: Friday, August 24, 2001 12:33 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Printable Version?
How does one create a printable version of a web page in ASP???
Message #3 by "Pham, Khanh" <Khanh.Pham@d...> on Fri, 24 Aug 2001 12:34:22 -0400
|
|
My page consist of many menus, banners, and finally data pulled from Oracle.
To get a printable version with no banners and menus this is how I did mine:
1. create an html page using the FileSystemObject
2. when displaying data from your normal page also write it out to the
printable version
3. create a link on the normal page to the printable page just created
4. delete the file when the session ends
hope this helps,
Khanh
-----Original Message-----
From: jprentice@e... [mailto:jprentice@e...]
Sent: Friday, August 24, 2001 12:33 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Printable Version?
How does one create a printable version of a web page in ASP???
Message #4 by Joshua Prentice <JPrentice@e...> on Fri, 24 Aug 2001 12:38:29 -0400
|
|
Ron,
Will this rearrange the page to fit on an 8/12x11 paper? This seems to be a
piece of code that prints the web page, no matter how it looks. But I may
be wrong.
Thanks for your quick response.
Josh
-----Original Message-----
From: Drew, Ron [mailto:RDrew@B...]
Sent: Friday, August 24, 2001 12:24 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Printable Version?
Add to the body...
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
if (window.print) {
document.write('<form>Press to '
+ '<input type=button name=print value="Print" '
+ 'onClick="javascript:window.print()"> this page!</form>');
}
// End -->
</script>
-----Original Message-----
From: jprentice@e... [mailto:jprentice@e...]
Sent: Friday, August 24, 2001 12:33 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Printable Version?
How does one create a printable version of a web page in ASP???
Message #5 by Joshua Prentice <JPrentice@e...> on Fri, 24 Aug 2001 12:40:33 -0400
|
|
This seems like it would help a lot, but I don't really understand what's
going on. Could you explain these four steps in greater detail?
Thanks.
Josh
-----Original Message-----
From: Pham, Khanh [mailto:Khanh.Pham@d...]
Sent: Friday, August 24, 2001 12:34 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Printable Version?
My page consist of many menus, banners, and finally data pulled from Oracle.
To get a printable version with no banners and menus this is how I did mine:
1. create an html page using the FileSystemObject
2. when displaying data from your normal page also write it out to the
printable version
3. create a link on the normal page to the printable page just created
4. delete the file when the session ends
hope this helps,
Khanh
-----Original Message-----
From: jprentice@e... [mailto:jprentice@e...]
Sent: Friday, August 24, 2001 12:33 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Printable Version?
How does one create a printable version of a web page in ASP???
Message #6 by "Pham, Khanh" <Khanh.Pham@d...> on Fri, 24 Aug 2001 12:56:28 -0400
|
|
1. Using the FileSystemObject you create a new html page like so:
Const ForWriting = 2 ' Input OutPut mode
Const Create = True
'Dimension local variables
Dim MyFile
Dim FSO ' FileSystemObject
Dim TSO ' TextStreamObject
Dim adoRs, Conn, sqlstring, strConnect
MyFile = server.MapPath("\waterobs\download")
MyFile = MyFile & "\" & session("WellName") & "_" &
Session("FileName") & ".htm"
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TS = FSO.OpenTextFile(MyFile, ForWriting, Create)
2. now write out the data and store it in a variable:
line0 = line0 & "<div>"
line0 = line0 & " <center>"
line0 = line0 & " <table border=""0"" cellspacing=""1"" width=""90%"">"
line0 = line0 & " <tr>"
line0 = line0 & " <td width=""71%"" colspan=""12"">"
line0 = line0 & " <p align=""center""><font size=""4"" face=Verdana
color=""navy"">"
line0 = line0 & " This is an Example<br>"
line1 = line1 & "your data goes here along with html tags including closing
the body and html"
Below I am writing to the thml page
TS.write "<html><head><title>"& Rs("ID")& " Annual Report (Print
Version)</title>"
TS.Write "<style>.over{FONT-SIZE: 10pt;BACKGROUND: green;
CURSOR: default; COLOR: white; FONT-FAMILY: Verdana, Tahoma}"
TS.write ".out{FONT-SIZE: 10pt; BACKGROUND: #0066cc; COLOR:
white; FONT-FAMILY: Verdana, Tahoma}</style></head><body topmargin='0'>"
TS.write line0
TS.write line1
3. create link on your normal page link so:
<a href="download/<%=session("WellName") & "_" & session("filename")
& ".htm"%>"><img src="images/printer.gif"><BR>Printable Format</a>
4. in global.asa session_onend delete the file like so:
oFSO.DeleteFile (strcsvFolderPath & Session("WellName") & "_" &
Session("FileName") &".htm")
This is just an abstract of what I have. Hopefully it will give you some
ideas. Let me know if i could further assist.
Khanh
-----Original Message-----
From: Joshua Prentice [mailto:JPrentice@e...]
Sent: Friday, August 24, 2001 12:41 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Printable Version?
This seems like it would help a lot, but I don't really understand what's
going on. Could you explain these four steps in greater detail?
Thanks.
Josh
-----Original Message-----
From: Pham, Khanh [mailto:Khanh.Pham@d...]
Sent: Friday, August 24, 2001 12:34 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Printable Version?
My page consist of many menus, banners, and finally data pulled from Oracle.
To get a printable version with no banners and menus this is how I did mine:
1. create an html page using the FileSystemObject
2. when displaying data from your normal page also write it out to the
printable version
3. create a link on the normal page to the printable page just created
4. delete the file when the session ends
hope this helps,
Khanh
-----Original Message-----
From: jprentice@e... [mailto:jprentice@e...]
Sent: Friday, August 24, 2001 12:33 PM
To: ASP Web HowTo
Subject: [asp_web_howto] Printable Version?
How does one create a printable version of a web page in ASP???
Message #7 by Joshua Prentice <JPrentice@e...> on Fri, 24 Aug 2001 13:05:33 -0400
|
|
Thanks -- I'll try it out.
-----Original Message-----
From: Pham, Khanh [mailto:Khanh.Pham@d...]
Sent: Friday, August 24, 2001 12:56 PM
To: ASP Web HowTo
Subject: [asp_web_howto] RE: Printable Version?
1. Using the FileSystemObject you create a new html page like so:
Const ForWriting = 2 ' Input OutPut mode
Const Create = True
'Dimension local variables
Dim MyFile
Dim FSO ' FileSystemObject
Dim TSO ' TextStreamObject
Dim adoRs, Conn, sqlstring, strConnect
MyFile = server.MapPath("\waterobs\download")
MyFile = MyFile & "\" & session("WellName") & "_" &
Session("FileName") & ".htm"
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set TS = FSO.OpenTextFile(MyFile, ForWriting, Create)
2. now write out the data and store it in a variable:
line0 = line0 & "<div>"
line0 = line0 & " <center>"
line0 = line0 & " <table border=""0"" cellspacing=""1"" width=""90%"">"
line0 = line0 & " <tr>"
line0 = line0 & " <td width=""71%"" colspan=""12"">"
line0 = line0 & " <p align=""center""><font size=""4"" face=Verdana
color=""navy"">"
line0 = line0 & " This is an Example<br>"
line1 = line1 & "your data goes here along with html tags including closing
the body and html"
Below I am writing to the thml page
TS.write "<html><head><title>"& Rs("ID")& " Annual Report (Print
Version)</title>"
TS.Write "<style>.over{FONT-SIZE: 10pt;BACKGROUND: green;
CURSOR: default; COLOR: white; FONT-FAMILY: Verdana, Tahoma}"
TS.write ".out{FONT-SIZE: 10pt; BACKGROUND: #0066cc; COLOR:
white; FONT-FAMILY: Verdana, Tahoma}</style></head><body topmargin='0'>"
TS.write line0
TS.write line1
3. create link on your normal page link so:
<a href="download/<%=session("WellName") & "_" & session("filename")
& ".htm"%>"><img src="images/printer.gif"><BR>Printable Format</a>
4. in global.asa session_onend delete the file like so:
oFSO.DeleteFile (strcsvFolderPath & Session("WellName") & "_" &
Session("FileName") &".htm")
This is just an abstract of what I have. Hopefully it will give you some
ideas. Let me know if i could further assist.
Khanh
Message #8 by <wburrough67@y...> on Sat, 25 Aug 2001 09:42:09 +0100
|
|
4GuysFromRolla did a nice piece on doing it using XMLHTTP and regular
expressions:
http://www.4guysfromrolla.com/webtech/052701-1.shtml
I haven't tried it but I reckon if you use Session variables in the page you
want to print it won't work - as the XMLHTTP request simulates another browser
(which gets a new sesssion id).
Walter
> -----Original Message-----
> From: jprentice@e... [mailto:jprentice@e...]
> Sent: Friday, August 24, 2001 12:33 PM
> To: ASP Web HowTo
> Subject: [asp_web_howto] Printable Version?
>
>
> How does one create a printable version of a web page in ASP???
>
Message #9 by "Monique Angelich" <mangelich@m...> on Sat, 25 Aug 2001 08:34:38 -0400
|
|
thank you walter. New browser window eh?
When opening, querystrings might be possible, but oh what a pain that would
be. (grin)
hm.. (wheels grind, catch and start turning)
Thank you very much for taking the time to answer my question. I truly
appreciate the help!
Monique
----- Original Message -----
From: "Walter Burrough" <wburrough67@y...>
To: "ASP Web HowTo" <asp_web_howto@p...>
Sent: Saturday, August 25, 2001 4:42 AM
Subject: [asp_web_howto] RE: Printable Version?
> 4GuysFromRolla did a nice piece on doing it using XMLHTTP and regular
> expressions:
> http://www.4guysfromrolla.com/webtech/052701-1.shtml
>
> I haven't tried it but I reckon if you use Session variables in the page
you
> want to print it won't work - as the XMLHTTP request simulates another
browser
> (which gets a new sesssion id).
>
> Walter
>
>
> > -----Original Message-----
> > From: jprentice@e... [mailto:jprentice@e...]
> > Sent: Friday, August 24, 2001 12:33 PM
> > To: ASP Web HowTo
> > Subject: [asp_web_howto] Printable Version?
> >
> >
> > How does one create a printable version of a web page in ASP???
> >
|
|
 |