Please advice me (:

M

Moore

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(AddressOf
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
 
C

Curt_C [MVP]

from the server?
Uh...... unless you use somethign to parse the HTML (like a browser) you
will get the tags
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,076
Latest member
OrderKetoBeez

Latest Threads

Top