Visual Studio .NET - printing of document using stream capture dll file

kapil tandon posted at 20-Nov-08 07:17

Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click

Try

Dim streamToPrint As StreamReader

Dim printFont As Font

Dim screencapturer As New ScreenshotCapture.ScreenCapture

Dim randomGenerator As New System.Random(2000)

Dim filePath As String = Application.StartupPath + "\tempScreenShoot" + randomGenerator.Next().ToString + ".jpg"

screencapturer.CaptureWindowToFile(Me.Handle, filePath, System.Drawing.Imaging.ImageFormat.Jpeg)

streamToPrint = New StreamReader(filePath)

printFont = New Font("Arial", 10)

Dim pd As New Printing.PrintDocument

Dim myDialog As New PrintDialog

myDialog.Document = pd

If myDialog.ShowDialog() = DialogResult.OK Then

pd.PrinterSettings = myDialog.PrinterSettings

pd.Print()

End If

Dim fileToBeDeleted As New System.IO.FileInfo(filePath)

fileToBeDeleted.Delete()

Catch ex As Exception

ExceptionManager.Publish(ex)

End Try

End Sub

 

this id the code i created for ptinting.it is creating jpg file and then finally printing.i am not able to figure out why it is printing the blank page.

can anybody tell me what is the problem in the code?

n hw can i achieve this task


Click here to sign in and reply. You could earn money via our message board contest just for being helpful.
  printing of document using stream capture dll file - kapil tandon  20-Nov-08 07:17 7:17:16 AM
View Posts

  

Search

search



Purchase