473,386 Members | 2,114 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,386 software developers and data experts.

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()
GetIEHeaderFooter(OldHeader, OldFooter)
SetIEHeaderFooter(" ", " ")
myprocess = New Process
myprocess.StartInfo.FileName = "temp.htm"
myprocess.StartInfo.Verb = "Print"
myprocess.StartInfo.CreateNoWindow = True
myprocess.EnableRaisingEvents = True
myprocess.Start()
end sub

Public Sub SetIEHeaderFooter(ByVal Header As String, ByVal Footer As
String)
Dim strKey As String = "Software\Microsoft\Internet
Explorer\PageSetup"
Dim oKey As RegistryKey = Registry.CurrentUser.OpenSubKey(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 GetIEHeaderFooter(ByRef Header As String, ByRef Footer As
String)
Dim strKey As String = "Software\Microsoft\Internet
Explorer\PageSetup"
Dim oKey As RegistryKey = Registry.CurrentUser.OpenSubKey(strKey,
False)
Header = oKey.GetValue("header")
Footer = oKey.GetValue("footer")
oKey.Close()
End Sub

Private Sub myprocess_Exited(ByVal sender As Object, ByVal e As
System.EventArgs) Handles myprocess.Exited
SetIEHeaderFooter(OldHeader, OldFooter)
End Sub
Nov 21 '05 #1
0 1880

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

Similar topics

10
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...
2
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...
0
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)...
2
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...
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...
2
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...
2
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...
0
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...
10
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...
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...

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.