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

Print HTML

The following code prints a .DOC file to the default printer without
prompting for a printer. I would like to do the same for an HTML file.
Unfortunately when I insert an HTM file in this code, I always get a prompt.
Is there a solution for HTM files?

myProcess.StartInfo.FileName = "D:\Temp\This is a test.doc"
myProcess.StartInfo.Verb = "PrintTo"
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.UseShellExecute = True
myProcess.Start()
If myProcess.Responding Then
myProcess.CloseMainWindow()
Else
myProcess.Kill()
End If

Dec 23 '05 #1
1 1797
This is because Internet Explorer is the default application to open HTML
files. If you want to use Word to open and print HTML files, try this:
Dim psi As System.Diagnostics.ProcessStartInfo psi = new
System.Diagnostics.ProcessStartInfo()

psi.Arguments = "<path to html file> /mFilePrintDefault /mFileExit"

psi.FileName = "winword.exe"

psi.CreateNoWindow = True

System.Diagnostics.Process.Start(psi)

However, this visibly opens Word application to do the operation.

HTH

"genojoe" <ge*****@discussions.microsoft.com> wrote in message
news:D8**********************************@microsof t.com...
The following code prints a .DOC file to the default printer without
prompting for a printer. I would like to do the same for an HTML file.
Unfortunately when I insert an HTM file in this code, I always get a prompt.
Is there a solution for HTM files?

myProcess.StartInfo.FileName = "D:\Temp\This is a test.doc"
myProcess.StartInfo.Verb = "PrintTo"
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.UseShellExecute = True
myProcess.Start()
If myProcess.Responding Then
myProcess.CloseMainWindow()
Else
myProcess.Kill()
End If
Dec 23 '05 #2

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

Similar topics

6
by: Andrew Chalk | last post by:
In a Python 2.2 app. running under CGI the statements print "Hello\n" print "World" print both words on the same line in IE6. How do I print the second one on a new line (i.e. respect the \n...
14
by: Marcin Ciura | last post by:
Here is a pre-PEP about print that I wrote recently. Please let me know what is the community's opinion on it. Cheers, Marcin PEP: XXX Title: Print Without Intervening Space Version:...
2
by: dan | last post by:
This works in mozilla but I can't figure out why this won't work in IE. Say I have this html <html> header goes here header goes here
3
by: Craig | last post by:
First of all, this one is driving me crazy, so thanks in advance for any help!! I've got a javascript function in a parent document that generates an HTML document on the fly when a button is...
21
by: Steel | last post by:
Hi at all, I have a very long html page with many photo. Therefore the best to print this page is to print the some page as PDF. Therefore I maked a PDF file like my page to print best. I'ld want...
4
by: Peter | last post by:
ASP.NET 1.1 Does anyone has an example where user can click on an link or button and print the current page? Thanks Peter
2
by: prophet | last post by:
how do I create a print button that is on my index page that prints my target page (and only the target page) I tried <INPUT onclick=window.print(); type=button value="Print This Page"...
2
by: dmorand | last post by:
When I try to print a 'print version' of my page it looks fine in IE 7, but when I print in IE 6 the margins are all screwed up. The page itself looks the same in both browsers, it's just when I...
66
by: happyse27 | last post by:
Hi All, my html code is sno 1) and perl code is sno 2). a) I tried to print $filename and it cant print out the value, only blank was displayed, and the file could not be uploaded. And it...
9
by: happyse27 | last post by:
Hi All, In perl script(item b below) where we check if html registration form are filled in properly without blank with the necessary fields, how to prompt users that the field are incomplete...
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
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
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
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,...
0
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...

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.