473,606 Members | 2,115 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 5373

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("W Script.Shell")
myHeader = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\header")
myFooter = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\footer")

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\header", ""
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\footer", ""

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

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\header", myHeader
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\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****@discuss ions.microsoft. com> wrote in message
news:60******** *************** ***********@mic rosoft.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("W Script.Shell")

//GET SECURITY
MySecurity = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\Securi ty\P3Global\Ena ble")

//GET HEADER and FOOTER INFORMATION
myHeader = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\header")
myFooter = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\footer")

//GET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
myMargin_Bottom = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\margin_bott om")
myMargin_Top = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\margin_top" )
myMargin_Left = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\margin_left ")
myMargin_Right = WSHShell.RegRea d("HKCU\Softwar e\Microsoft\Int ernet
Explorer\PageSe tup\margin_righ t")
// SET SECURITY TO LOW
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\Securi ty\P3Global\Ena ble", "0"

//SET HEADER and FOOTER INFORMATION
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\header", ""
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\footer", ""

//SET MARGIN INFORMATION {bottom, top, left. right, orientation, paper
size, paper source}
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_bott om", "0.05"
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_top" , "0.5"
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_left ", "0.3"
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_righ t", "0.05"

window.print();

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

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\Securi ty\P3Global\Ena ble", "1"

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\header", myHeader
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\footer", myFooter

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_bott om", myMargin_Bottom
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_top" , myMargin_Top
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_left ", myMargin_Left
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_righ t", 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("W Script.Shell")

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\Securi ty\P3Global\Ena ble", "1"

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\header", myHeader
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\footer", myFooter

WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_bott om", myMargin_Bottom
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_top" , myMargin_Top
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_left ", myMargin_Left
WSHShell.RegWri te "HKCU\Software\ Microsoft\Inter net
Explorer\PageSe tup\margin_righ t", 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="ResetH eader()">

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

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
17397
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
2211
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 "compile the questions" into a theoretical problem to see what people think should be done to solve it. Maybe it will be a worthwhile discussion, but more importantly maybe it will find out the very best way to sort this kind of problem out so that...
0
1819
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 with the file system (including printing) from the web browser. How do I disabled this so I can get my windows form control to work within IE? Also, do any have any printing code or know how I can implement multipage printing using the...
7
1676
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 requires 2 pages . The first page is ok, but in the second page of the printing I have no ligne of the row and no ligne of the column printing on the page!
2
2879
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 printers A3 and A4 type) At this time I'm trying to figure out what would be the best way to accomplish this : 1. printing through HTML in a IE windows will result in page title & nr as header and URL + Date as footer, wich is far from acceptable....
12
6347
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 of course it's thrown up a whole host of new issues... I'm generating a multi page printable document in HTML from my app, and displaying it in a WebBrowser control. I've looked into using some CSS
4
5894
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 hosting my application. Step 1) The user clicks the Print icon in the web page
8
5884
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 clients (Internet Explorer). My flash content was originally brought in via the “flash satay” method, but I have since used some server-side magic do deliver one <objecttag
0
2223
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 application specific headers are to be added in the print out. Problem: The System.Drawing.Printing namespace .Net provides objects and dialogs to take care of basic print tasks. But there is no native support of printing RTF and HTML formats. One would...
0
1680
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 number of rows in the table returned from the database. These chart images are put into an HTML table through code-behind. They display nicely in either IE or FireFox. But, there is a problem printing them when the chart image is too big to fit...
0
8009
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
7939
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8432
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...
1
8078
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
8299
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
5456
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3964
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2442
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
0
1285
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.