print the jpeg file using screencapture dll in vb.net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • hello12356789
    New Member
    • Nov 2008
    • 5

    #1

    print the jpeg file using screencapture dll in vb.net

    [CODE=VB]

    Private Sub PrintToolStripM enuItem_Click(B yVal sender As System.Object, ByVal e As System.EventArg s) Handles PrintToolStripM enuItem.Click

    Try

    Dim streamToPrint As StreamReader

    Dim printFont As Font

    Dim screencapturer As New ScreenshotCaptu re.ScreenCaptur e

    Dim randomGenerator As New System.Random(2 000)

    Dim filePath As String = Application.Sta rtupPath + "\tempScreenSho ot" + randomGenerator .Next().ToStrin g + ".jpg"

    screencapturer. CaptureWindowTo File(Me.Handle, filePath, System.Drawing. Imaging.ImageFo rmat.Jpeg)

    streamToPrint = New StreamReader(fi lePath)

    printFont = New Font("Arial", 10)

    Dim pd As New Printing.PrintD ocument

    Dim myDialog As New PrintDialog

    myDialog.Docume nt = pd

    If myDialog.ShowDi alog() = DialogResult.OK Then

    pd.PrinterSetti ngs = myDialog.Printe rSettings

    pd.Print()

    End If

    Dim fileToBeDeleted As New System.IO.FileI nfo(filePath)

    fileToBeDeleted .Delete()

    Catch ex As Exception

    ExceptionManage r.Publish(ex)

    End Try

    End Sub
    [/CODE]


    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
    Last edited by Dököll; Nov 24 '08, 12:54 AM. Reason: code tags...
  • Dököll
    Recognized Expert Top Contributor
    • Nov 2006
    • 2379

    #2
    Hello Hello!

    I added a couple of code tags for you, sending over to .NET for ya, for a closer look.

    Hope this helps!

    Comment

    • Curtis Rutland
      Recognized Expert Specialist
      • Apr 2008
      • 3264

      #3
      Moved to Answers instead of Insights.

      Comment

      Working...