Hi all, <BR>I have asked a question in this forum on how to print asp.net but no one has replied....<BR>Well i have something that i have tried but i always get error while prinitng please look at it and let me know if u have any ideas.<BR><BR>Imports System.ComponentModel<BR>Imports System.Drawing<BR>Imports System.Drawing.Printing<BR>Imports System.IO<BR>Imports System.Collections<BR><BR><BR>Public Class WebForm3<BR> Inherits System.Web.UI.Page<BR><BR> Private printFont As Font<BR> Private streamToPrint As StreamReader<BR> Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox<BR> Protected WithEvents Button1 As System.Web.UI.WebControls.Button<BR> Protected WithEvents lblTest As System.Web.UI.WebControls.Label<BR> Private Shared filePath As String<BR><BR>#Region " Web Form Designer Generated Code "<BR><BR> &#039;This call is required by the Web Form Designer.<BR> &#060;System.Diagnostics.DebuggerStepThrough()&#06 2; Private Sub InitializeComponent()<BR><BR> End Sub<BR><BR> Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init<BR> &#039;CODEGEN: This method call is required by the Web Form Designer<BR> &#039;Do not modify it using the code editor.<BR> InitializeComponent()<BR> End Sub<BR><BR>#End Region<BR><BR><BR> &#039; The PrintPage event is raised for each page to be printed.<BR> Private Sub pd_PrintPage(ByVal sender As Object, ByVal ev As PrintPageEventArgs)<BR> Dim linesPerPage As Single = 0<BR> Dim yPos As Single = 0<BR> Dim count As Integer = 0<BR> Dim leftMargin As Single = ev.MarginBounds.Left<BR> Dim topMargin As Single = ev.MarginBounds.Top<BR> Dim line As String = Nothing<BR> Dim printFont = New Font("Arial", 10)<BR> Dim streamToPrint = New StreamReader("c: estreamlogscserv.log")<BR>30:<BR> &#039; Calculate the number of lines per page.<BR> linesPerPage = ev.MarginBounds.Height / printFont.GetHeight(ev.Graphics)<BR><BR> &#039; Iterate over the file, printing each line.<BR> While count &#060; linesPerPage<BR> line = streamToPrint.ReadLine()<BR> If line Is Nothing Then<BR> Exit While<BR> End If<BR> yPos = topMargin + count * printFont.GetHeight(ev.Graphics)<BR> ev.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, _<BR> yPos, New StringFormat())<BR> count += 1<BR> End While<BR><BR> &#039; If more lines exist, print another page.<BR> If Not (line Is Nothing) Then<BR> ev.HasMorePages = True<BR> Else<BR> ev.HasMorePages = False<BR> End If<BR> End Sub<BR><BR> Public Sub Page_Load()<BR> End Sub<BR><BR> Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click<BR> Dim streamToPrint = New StreamReader("c: estreamlogscserv.log")<BR> Dim printFont = New Font("Arial", 10)<BR> Dim pd As New PrintDocument()<BR> AddHandler pd.PrintPage, AddressOf pd_PrintPage<BR><BR> pd.PrinterSettings.PrinterName = "dave"<BR><BR> If pd.PrinterSettings.IsValid Then<BR> lblTest.Text = "Printer name was valid."<BR><BR> pd.Print()<BR> Else<BR> lblTest.Text = "Printer is invalid."<BR> End If<BR> streamToPrint.Close()<BR> End Sub<BR>End Class<BR>