469,883 Members | 1,231 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,883 developers. It's quick & easy.

Printing HTML or ASP.NET Page

Hi,

I have an html page and I might be moving to asp.net page that contains a
some kind of forum and string.

It is kind of application form. User have to enter some (string) value into
the forum which forum actualy similar to small article.

Then user have to use PRINT button to print the page. My problem is that
when I try to print it prints the HTML Name on top left as well as the page
number on top right. Plus it is also prints the page link on Left side of the
bottom of the page.

I do not want to print the HTML page title, page number and the page link.
Does anyone knows good article or at this small example that shows how to
over come from this problem.

I thank you for your kind understanding to reading my mail for your future
help.

Rgds,
GC
Nov 7 '05 #1
5 5209

hello,

these details are added in the browser preferences...
(File => page setup)
and you can't change it with regular web scripting unfortunately.

you can buy a third party activex object though to aid you with this problem.
for example:
http://www.meadroid.com/scriptx/docs/printdoc.htm

interwanderer


"Niyazi" wrote:
Hi,

I have an html page and I might be moving to asp.net page that contains a
some kind of forum and string.

It is kind of application form. User have to enter some (string) value into
the forum which forum actualy similar to small article.

Then user have to use PRINT button to print the page. My problem is that
when I try to print it prints the HTML Name on top left as well as the page
number on top right. Plus it is also prints the page link on Left side of the
bottom of the page.

I do not want to print the HTML page title, page number and the page link.
Does anyone knows good article or at this small example that shows how to
over come from this problem.

I thank you for your kind understanding to reading my mail for your future
help.

Rgds,
GC

Nov 7 '05 #2
Hi interwanderer,

I don't have that much money to buy the third party ActiveX object. I see
the link before but as I wrote above money is the problem.

I also find this small script:
-----------------------------------------------------------------------------------------------
<script type="text/vbscript">
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")
myHeader = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header")
myFooter = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer")

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", ""
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", ""

Sub ResetHeader()
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", myHeader
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", myFooter
End Sub
</script>
-----------------------------------------------------------------------------------------------

I place the script end of the </head> tag and above the body tag. I am
trying to show where I placed it in above line:

------------------------------------------------------------------------------------------------

<head>
.....
.....
.....

above script

</head>

<body lang=EN-US style='tab-interval:.5in'>
....
.....
.....
----------------------------------------------------------------------------------------------

But when I try to click print button it doesn't print. I allow the code to
run due to security bar that appears on top of the page but still no printing
and and the bottom of the tray icon area my printer shows some error.

Do you know how to use the above script to run the page and when user press
the PRINT button that it will print without the header and footer information.

Thank you very much for kind understanding.

Rgds,
GC

Nov 7 '05 #3
have tyou looked at css print style sheets

http://www.alistapart.com/articles/goingtoprint/

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

"Niyazi" <Ni****@discussions.microsoft.com> wrote in message
news:60**********************************@microsof t.com...
Hi,

I have an html page and I might be moving to asp.net page that contains a
some kind of forum and string.

It is kind of application form. User have to enter some (string) value
into
the forum which forum actualy similar to small article.

Then user have to use PRINT button to print the page. My problem is that
when I try to print it prints the HTML Name on top left as well as the
page
number on top right. Plus it is also prints the page link on Left side of
the
bottom of the page.

I do not want to print the HTML page title, page number and the page link.
Does anyone knows good article or at this small example that shows how to
over come from this problem.

I thank you for your kind understanding to reading my mail for your future
help.

Rgds,
GC

Nov 7 '05 #4
Hi John

I saw the article before. But I dont know how to use the CSS. And I am not
familar with html or ASP.NET.

I was created big windows base client server application and I am only
programmer and my boss keep giving me new assignment.

As I wrote before we have 15 forms that user must fill few text boxes and
print irt like word pages. My boss want to put all the 15 forum into intranet
so user can fill the forum and then they must print the forum that our
coustemer can sign in signature area.

I try last night the deletring header and footer section via code that I
posted before
and it worked well. But when I printed I can see the square that was the
text boxes.

The CSS might be good to over come this difficulties but I haven't used it
before.
Now my major problem is how to disable the visibility of the text boxe
squares.

I thank you for your kind comment on my problem. I will try to study the CSS
article that you posted the link but I guess it must be very good to me if I
can find live demo or example that shows clearly how to Print HTML with CSS.

Thank you.

Rgds,
GC
Nov 8 '05 #5
Hi all

I have follwing VBScript inside my html <head> tag:

-----------------------------------------------------------------------------------------------
<script type="text/vbscript">

// PRINT BUTTON ACTIVATED
Sub PrintMe()
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

//GET SECURITY
MySecurity = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable")

//GET HEADER and FOOTER INFORMATION
myHeader = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header")
myFooter = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer")

//GET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
myMargin_Bottom = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom")
myMargin_Top = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top")
myMargin_Left = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left")
myMargin_Right = WSHShell.RegRead("HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right")
// SET SECURITY TO LOW
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable", "0"

//SET HEADER and FOOTER INFORMATION
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", ""
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", ""

//SET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", "0.05"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", "0.5"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", "0.3"
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", "0.05"

window.print();

// CLEAR THE TEXT BOXES
txt1.value = ""
txt2.value = ""
txt3.value = ""
txt4.value = ""
txt5.value = ""
txt6.value = ""
txt7.value = ""

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable", "1"

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", myHeader
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", myFooter

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", myMargin_Bottom
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", myMargin_Top
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", myMargin_Left
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", myMargin_Right
End Sub

//CANCEL BUTTON ACTIVATED
Sub ResetHeader()
// CLEAR THE TEXT BOXES
txt1.value = ""
txt2.value = ""
txt3.value = ""
txt4.value = ""
txt5.value = ""
txt6.value = ""
txt7.value = ""

Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\Security\P3Global\Enable", "1"

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\header", myHeader
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\footer", myFooter

WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_bottom", myMargin_Bottom
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_top", myMargin_Top
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_left", myMargin_Left
WSHShell.RegWrite "HKCU\Software\Microsoft\Internet
Explorer\PageSetup\margin_right", myMargin_Right

End Sub
</script>
-----------------------------------------------------------------------------------------------

And in my Rset and Print button has this code:

<input name="Reset" type="reset" id="Reset" value="Reset"
onClick="ResetHeader()">

<input name="Print" type="submit" id="Print" value="Print"
onclick="PrintMe()">

But It doesnot Print nor Reset the html page. In html page I have few
textBoxes and there are no form object.

The error are:
- Type Mismatch PrintMe()
- Type Mismatch ResetHeader()

Does anyone knows how to over come from this problem?

I thank you in advance for your future help.

Rgds,
GC

Nov 9 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Alec | last post: by
5 posts views Thread by Mark Preston | last post: by
7 posts views Thread by Amirallia | last post: by
2 posts views Thread by Jurjen de Groot | last post: by
12 posts views Thread by Alex Clark | last post: by
4 posts views Thread by Lucas Ponzo | last post: by
reply views Thread by gnewsgroup | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.