473,748 Members | 5,232 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

printing html file without Header and footer

Hello :)
this is a repost... i ve been looking for a way since last week ...
i have a template html file that i modify from my code... i need to print
this file without IE's Header and Footer
or any print dialog then once the printing's done... restore the original
Header and footer

but here's what happens:

- save the current header and footer
- clear the header and footer
- the printing process is started
- process exits...
- print dialog shown
- restore header and footer

since i press the print button on the dialog after the process exit ... the
header and footer are restored and printed :(

here s my code if anyone can help...

Imports Microsoft.Win32

Private WithEvents myprocess As Process
Private OldHeader As String
Private OldFooter As String

private sub printhtml()
GetIEHeaderFoot er(OldHeader, OldFooter)
SetIEHeaderFoot er(" ", " ")
myprocess = New Process
myprocess.Start Info.FileName = "temp.htm"
myprocess.Start Info.Verb = "Print"
myprocess.Start Info.CreateNoWi ndow = True
myprocess.Enabl eRaisingEvents = True
myprocess.Start ()
end sub

Public Sub SetIEHeaderFoot er(ByVal Header As String, ByVal Footer As
String)
Dim strKey As String = "Software\Micro soft\Internet
Explorer\PageSe tup"
Dim oKey As RegistryKey = Registry.Curren tUser.OpenSubKe y(strKey,
True)
If Not Header = vbNullString Then
oKey.SetValue(" header", Header)
End If

If Not Footer = vbNullString Then
oKey.SetValue(" footer", Footer)
End If
oKey.Close()
End Sub

Public Sub GetIEHeaderFoot er(ByRef Header As String, ByRef Footer As
String)
Dim strKey As String = "Software\Micro soft\Internet
Explorer\PageSe tup"
Dim oKey As RegistryKey = Registry.Curren tUser.OpenSubKe y(strKey,
False)
Header = oKey.GetValue(" header")
Footer = oKey.GetValue(" footer")
oKey.Close()
End Sub

Private Sub myprocess_Exite d(ByVal sender As Object, ByVal e As
System.EventArg s) Handles myprocess.Exite d
SetIEHeaderFoot er(OldHeader, OldFooter)
End Sub
Nov 21 '05 #1
0 1907

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
1784
by: Andrew | last post by:
I am making a web site and I am using ASP because of its templating capabilities. My footer is an include file, for obvious reasons. I can't use an include file for the header, because, while the top of the page will be 90% similar, they will have different titles, page titles, and left nav menus. I could write a function so that these vars can be interpolated, except I don't want 70 lines of Response.Write("foo") (there is a moderate...
2
2476
by: Dragan Kovac | last post by:
Hello everyone, I have a problem. I generated some kind of my own report (by building HTML file) and now I want to print it. Printing itself is not a problem, problem is with adding custom headers and footers on every printed page. How can I do it? Some nice example would be reeeeally great! In header I want to put a picture, some text, and in footer I would like to have page counter and some small text displayed... I've heard...
0
1895
by: Niyazi | last post by:
Hi all, This my aspx page first line of code. <%@ Page CodeBehind="index.aspx.vb" Language="vb" AutoEventWireup="false" Inherits="TB.index" %> Than inside head tag I have following script(s) --------------------------------------------------------------------------------------------------------------------- <script language="JavaScript"> //Disable Mouse Right Click Button
2
9271
by: LilBuh | last post by:
hi there :) i ve been looking for some time a way to print an html file from vb.net i came up with this code for printing and removing the header and footer from IE then once the printing is done restore the original header and footer Imports Microsoft.Win32 Private WithEvents myprocess As Process Private OldHeader As String
12
6377
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
2
3039
by: letsgetsilly | last post by:
I'm developing the external corporate website for my company in Visual Studio 2003 using html, css, and a user web control for the header/navigation. When I try to print any of the pages only the header image (an <img> located in the Web User control) and the footer (also <img>) will print, but none of the text, graphics, background colors, or background images that are included. My page is a liquid 3 column + 1 header + 1 footer CSS...
2
2637
by: johnb41 | last post by:
I'm using .NET 2.0. My form is displaying the webbrowser control, which is displaying some HTML text. When printing with webbrowser.print(), my printout includes the header and footer. How can I remove the header and footer from the print out? Can this be done? If i can suppress the header and footer, i think this might be a really
0
5323
by: Andrew Meador | last post by:
I have implemented a printing scenario where an html file is printed using the the following code: public void PrintHtmlFile(string url) { RegistryKey IERegKey; string header = null; string footer = null; object o = null; InternetExplorerClass ie = null;
10
6975
by: happyse27 | last post by:
Hi All, I got this apache errors(see section A1 and A2 below) when I used a html(see section b below) to activate acctman.pl(see section c below). Section D below is part of the configuration of section c. Not sure where went wrong as the web page displayed internal server error. Also, what is the error 543? and error 2114. Where to find the list of errors in websites as it is not the standard apache error. I could not find...
0
9374
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9249
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
8244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6076
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
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3315
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
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
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.