search
Japanese Chinese Nederlands Espanol Italiano Deutsch Francais Twitter Rss Feeds
MicrosoftArticlesForumsFAQs
C# .NET
VB.NET
Visual Studio .NET
ADO.NET
Xml / Xslt
VB 6.0
.NET CF
GDI+
LINQ
Deployment
Security
FoxPro
Silverlight / WPF
Entity Framework
RIA Services

Web ProgrammingArticlesForumsFAQs
JavaScript
ASP
ASP.NET
Web Services

Non-MicrosoftArticlesForumsFAQs
NHibernate
Perl
PHP
Ruby
Java
Linux / Unix
Apple
Open Source

DatabasesArticlesForumsFAQs
SQL Server
Access
Oracle
MySQL
Other Databases

OfficeArticlesForumsFAQs
Excel
Word
Powerpoint
Outlook
Publisher
Money

Operating SystemsArticlesForumsFAQs
Windows 7
Windows Server
Windows Vista
Windows XP
Windows Update
MAC
Linux / UNIX

Server PlatformsArticlesForumsFAQs
BizTalk
Site Server
Exhange Server
IIS

Graphic DesignArticlesForumsFAQs
Macromedia Flash
Adobe PhotoShop
Expression Blend
Expression Design
Expression Web

OtherArticlesForumsFAQs
Subversion / CVS
Ask Dr. Dotnetsky
Active Directory
Networking
Uninstall Virus
Job Openings
Product Reviews
Search Engines
Resumes

 

View Other Visual Studio .NET Posts   Ask New Question 
printing of document using stream capture dll file
kapil tandon posted at Thursday, November 20, 2008 7:17 AM

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