473,396 Members | 1,990 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,396 software developers and data experts.

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 5358

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Alec | last post by:
Hi, I am trying to print an HTML page from Internet Explorer and it always put the page title and page count at the top of the page. How can I disable printing page title and page count? Thanks.
5
by: Mark Preston | last post by:
Admission first - I don't actually have a problem here but have noticed that a lot of people have been asking similar questions and getting very varied answers. What I've done is to sort of...
0
by: Nigel | last post by:
I successfully create a .NET Component (Visual Basic .NET) that would print, unfortunately when used within a web browser it appears that .NET security doesn't allow you to run code that interacts...
7
by: Amirallia | last post by:
Hello! I have a wecontrol table in a page, this table has a number of variable rows depending of the choice of the user. But when the table has a large number of rows, the printing of the page...
2
by: Jurjen de Groot | last post by:
I'm about to start a new ASP.NET application, this application will generate several types of documents (PDF HTML XML-DOC) wich have to be printed at the client-side... (probably on different...
12
by: Alex Clark | last post by:
Greetings, (.NET 2.0, WinXP Pro/Server 2003, IE6 with latest service packs). I've decided to take advantage of the layout characteristics of HTML documents to simplify my printing tasks, but...
4
by: Lucas Ponzo | last post by:
Hi All, I have an ASP.NET 2.0 app. The users access the pages, uniquely via pocket pc ... I need to print a page. But I need that the page print on a printer installed on the web server...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
0
by: nikhilgargi | last post by:
Requirement: I need to provide printing capability in a C# desktop application that I am developing The documents that need to be printed can be in Rich Text Format (RTF) or HTML. Custom...
0
by: gnewsgroup | last post by:
In my asp.net 2.0 web application. I create chart images on the fly by getting the data from the database. These chart images all have fixed width, but the height is dynamic depending on the...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
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...
0
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...

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.