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

How do I print an html file ?

C.K
Hello all,

I am still working on my calendar program, and I have decided that
the best way is for my vb program to write html tags into a file and
then to print the file from ie6. Everything is fine, the only thing that
I would like to do is to have my program print the html file
automatically. I saw the printdocument object, but I wanted to know,
firstly if it's possible, and secondly if I should use this object and how?

Tia
C.K.
Nov 21 '05 #1
3 1545
* "C.K" <assdadad> scripsit:
I am still working on my calendar program, and I have decided that
the best way is for my vb program to write html tags into a file and
then to print the file from ie6. Everything is fine, the only thing that
I would like to do is to have my program print the html file
automatically.


\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.htm"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

- or -

<URL:http://groups.google.de/groups?selm=%23695K4B7CHA.548%40TK2MSFTNGP11.phx.g bl>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Nov 21 '05 #2
C.K

Hello again
:)

Your code does work, but I need something a little extra :
Before I can print the document I have to select the
'Page Setup' command from the File menu in IE6 and
choose A4 and setup the margins. Is there a way to
automise this either from dotnet, or even if perhaps there
are html tags which can control the browser (meta tags?)

Tia
C.K.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:OS**************@TK2MSFTNGP11.phx.gbl...
* "C.K" <assdadad> scripsit:
I am still working on my calendar program, and I have decided that
the best way is for my vb program to write html tags into a file and
then to print the file from ie6. Everything is fine, the only thing that
I would like to do is to have my program print the html file
automatically.
\\\
Dim p As New System.Diagnostics.ProcessStartInfo()
p.Verb = "print"
p.WindowStyle = ProcessWindowStyle.Hidden
p.FileName = "C:\filename.htm"
p.UseShellExecute = True
System.Diagnostics.Process.Start(p)
///

- or -

<URL:http://groups.google.de/groups?selm=...K2MSFTNGP11.ph
x.gbl>
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Nov 21 '05 #3

"C.K" <assdadad> wrote in message
news:uL**************@TK2MSFTNGP12.phx.gbl...
Your code does work, but I need something a little extra :
Before I can print the document I have to select the
'Page Setup' command from the File menu in IE6 and
choose A4 and setup the margins. Is there a way to
automise this either from dotnet, or even if perhaps there
are html tags which can control the browser (meta tags?)


Check out print templates. Also, you might like to look at the code here:

http://www.itwriting.com/htmleditor/index.php

There's code that makes it very easy to get print and print preview using a
print template. It doesn't make it easy to author the print template
though - you'd need to consult MSDN for that.

Tim
Nov 21 '05 #4

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

Similar topics

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:...
5
by: vegetax | last post by:
How can i use cgi'like print statement in a multitreaded web framework? each thread has its own Servlet instance with request/response objects, sys.stdout = self.response(which is a file like...
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...
1
by: David Templet | last post by:
I have a C# application that generates its reports in HTML. After it creates the report, it opens it in IE so it can be viewed or printed. I would like to add the ability to print the report...
6
by: moony marouane | last post by:
Hi Everybody I have a problem opening a file with ADODB.Stream when <HTML> exists on the same page here is the code I use : =================================== <HTML> <%
0
by: thirunavukarasukm | last post by:
Hai.... To print Html page using PrintDialog and Print Document i am created one windows appication.. the windows application have many pages in my booking page i have two buttons one...
2
by: bangad | last post by:
this code print file in browser but in in tabular form like in .csv file.....kindly help me out.... #!/usr/bin/perl -w # use lib use strict; use CGI; # limit 1000K bytes post, permit upload...
3
by: Andrew Meador | last post by:
I have a button on my form to "Print". I would like to create an HTML file, of the output, and call the Explorer...Print function when this "Print" button is clicked. How can I do this - the...
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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.