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

Please advice me (:

Hi all,

I am trying to create HTML file and print it automatically, which was
possible with the below code...but somehow, it is printing with all
<HTML> tags...could somebody tell me , how to print the HTML file
without , all those HTML tags...??

Please help me...(:

- Moore

======
Dim temp as streamreader = New
StreamReader("C:\Inetpub\wwwroot\test.html")
Dim prntFont as Font = New Font("Arial", 10)

Dim pd As New PrintDocument
AddHandler pd.PrintPage, New
System.Drawing.Printing.PrintPageEventHandler(Addr essOf
Me.pd_PrintPage)
pd.PrinterSettings.PrinterName = printername
If pd.PrinterSettings.IsValid Then
pd.Print()
End If


=======
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As
System.Drawing.Printing.PrintPageEventArgs)

Dim lpp As Single = 0
Dim yPos As Single = 0
Dim count As Integer = 0
Dim leftMargin As Single = ev.MarginBounds.Left
Dim topMargin As Single = ev.MarginBounds.Top
Dim line As String = Nothing

'Work out the number of lines per page
'Use the MarginBounds on the event to do this
lpp = ev.MarginBounds.Height / prntFont.GetHeight(ev.Graphics)

line = stringToPrint.ReadToEnd

While (count < lpp And line <> Nothing)

yPos = topMargin + (count * prntFont.GetHeight(ev.Graphics))

ev.Graphics.DrawString(line, prntFont, Brushes.Black, leftMargin, yPos,
New StringFormat)

count = count + 1

If (count < lpp) Then
line = temp.ReadToEnd
End If

End While

'If we have more lines then print another page
If (line <> Nothing) Then
ev.HasMorePages = True
Else
ev.HasMorePages = False
End If

End Sub
=====

rider_2004
View Public Profile
Send a private message to rider_2004
Find More Posts by rider_2004
Add rider_2004 to Your Buddy List

Nov 19 '05 #1
3 1023
from the server?
Uh...... unless you use somethign to parse the HTML (like a browser) you
will get the tags

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Moore" <ra**********@yahoo.com> wrote in message
news:11**********************@c13g2000cwb.googlegr oups.com...
Hi all,

I am trying to create HTML file and print it automatically, which was
possible with the below code...but somehow, it is printing with all
<HTML> tags...could somebody tell me , how to print the HTML file
without , all those HTML tags...??

Please help me...(:

- Moore

======
Dim temp as streamreader = New
StreamReader("C:\Inetpub\wwwroot\test.html")
Dim prntFont as Font = New Font("Arial", 10)

Dim pd As New PrintDocument
AddHandler pd.PrintPage, New
System.Drawing.Printing.PrintPageEventHandler(Addr essOf
Me.pd_PrintPage)
pd.PrinterSettings.PrinterName = printername
If pd.PrinterSettings.IsValid Then
pd.Print()
End If


=======
Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As
System.Drawing.Printing.PrintPageEventArgs)

Dim lpp As Single = 0
Dim yPos As Single = 0
Dim count As Integer = 0
Dim leftMargin As Single = ev.MarginBounds.Left
Dim topMargin As Single = ev.MarginBounds.Top
Dim line As String = Nothing

'Work out the number of lines per page
'Use the MarginBounds on the event to do this
lpp = ev.MarginBounds.Height / prntFont.GetHeight(ev.Graphics)

line = stringToPrint.ReadToEnd

While (count < lpp And line <> Nothing)

yPos = topMargin + (count * prntFont.GetHeight(ev.Graphics))

ev.Graphics.DrawString(line, prntFont, Brushes.Black, leftMargin, yPos,
New StringFormat)

count = count + 1

If (count < lpp) Then
line = temp.ReadToEnd
End If

End While

'If we have more lines then print another page
If (line <> Nothing) Then
ev.HasMorePages = True
Else
ev.HasMorePages = False
End If

End Sub
=====

rider_2004
View Public Profile
Send a private message to rider_2004
Find More Posts by rider_2004
Add rider_2004 to Your Buddy List

Nov 19 '05 #2
Max
Thanks Curt for the reply...Do u have any suggestion , how we can parse
the HTML...?

Nov 19 '05 #3
Use a browser, or a browser component

--
Curt Christianson
Site & Scripts: http://www.Darkfalz.com
Blog: http://blog.Darkfalz.com
"Max" <sh*****@hotmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...
Thanks Curt for the reply...Do u have any suggestion , how we can parse
the HTML...?

Nov 19 '05 #4

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

Similar topics

39
by: Scotter | last post by:
Okay I think my title line was worded misleadingly. So here goes again. I've got quite 20 identical MDB files running on an IIS5 server. From time to time I need to go into various tables and add...
2
by: andyjgw | last post by:
Hi I'm a bit new to the designing of custom web page controls and using them in the properties designer window - need a little advice on a concept here. I have two properties in my control -...
13
by: Allan Cammish | last post by:
I am looking for advice on the best method of producing a piece of software written in Visual Basic or Visual Basic.NET that will control another standard windows program such as ‘Notepad' using...
1
by: David Van D | last post by:
Hi there, A few weeks until I begin my journey towards a degree in Computer Science at Canterbury University in New Zealand, Anyway the course tutors are going to be teaching us JAVA wth bluej...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
66
by: genestarwing | last post by:
QUESTION: Write a program that opens and read a text file and records how many times each word occurs in the file. Use a binary search tree modified to store both a word and the number of times it...
22
by: rasiel | last post by:
I'm hoping someone can help me out. I'm a researcher in need of developing an automated database and would like to see if someone here is willing to consider putting together for me a simple...
27
by: postrishi | last post by:
Hello Folks, I am doing my engineering in computer science. I basically want to work in systems rather than in application. But the main problem with me that i dont have adequate guidance...
1
by: =?Utf-8?B?RW1tYSBIb3Bl?= | last post by:
Hi All, I need some advice please. I have very good knowledge of MS Access, Excel etc, reasonable knowledge of VBA and some very basic knowledge of VB6 and virtually non-existant knowledge of...
7
by: mohammaditraders | last post by:
Write a program which overloads a binary Minus (+) operator, The program will contain a class Matrix, This class will contain a private data member Array which store int values. The class will...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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...
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...

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.