473,320 Members | 2,164 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

print the jpeg file using screencapture dll in vb.net

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub PrintToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PrintToolStripMenuItem.Click
  3.  
  4. Try
  5.  
  6. Dim streamToPrint As StreamReader
  7.  
  8. Dim printFont As Font
  9.  
  10. Dim screencapturer As New ScreenshotCapture.ScreenCapture
  11.  
  12. Dim randomGenerator As New System.Random(2000)
  13.  
  14. Dim filePath As String = Application.StartupPath + "\tempScreenShoot" + randomGenerator.Next().ToString + ".jpg"
  15.  
  16. screencapturer.CaptureWindowToFile(Me.Handle, filePath, System.Drawing.Imaging.ImageFormat.Jpeg)
  17.  
  18. streamToPrint = New StreamReader(filePath)
  19.  
  20. printFont = New Font("Arial", 10)
  21.  
  22. Dim pd As New Printing.PrintDocument
  23.  
  24. Dim myDialog As New PrintDialog
  25.  
  26. myDialog.Document = pd
  27.  
  28. If myDialog.ShowDialog() = DialogResult.OK Then
  29.  
  30. pd.PrinterSettings = myDialog.PrinterSettings
  31.  
  32. pd.Print()
  33.  
  34. End If
  35.  
  36. Dim fileToBeDeleted As New System.IO.FileInfo(filePath)
  37.  
  38. fileToBeDeleted.Delete()
  39.  
  40. Catch ex As Exception
  41.  
  42. ExceptionManager.Publish(ex)
  43.  
  44. End Try
  45.  
  46. End Sub
  47.  

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
Nov 20 '08 #1
2 2085
Dököll
2,364 Expert 2GB
Hello Hello!

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

Hope this helps!
Nov 24 '08 #2
Curtis Rutland
3,256 Expert 2GB
Moved to Answers instead of Insights.
Dec 6 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: me | last post by:
Hey all, well i am also a newbie :) i saw this on many sites: <img src="somephp.php?blabla" width="100"> how can i make that to? i want to reffer to a php file that returns or prints a jpg...
7
by: Henri Schomäcker | last post by:
Hi folks, I got a windows com executable which returns a jpg image in a BSTR. Let's say, the var that holds the data is $imgData. With perl, in a cgi script, I may simpy write:...
14
by: Michael Levin | last post by:
I've got the following problem. I'm a biologist and I have a device at work which monitors my frog habitat. The device has a bunch of sensors, and runs an embedded html server with some java...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
0
by: Johann Blake | last post by:
In my need to decode a JPEG 2000 file, I discovered like many that there was no functionality for this in the .NET Framework. Instead of forking out a pile of cash to do this, I came up with the...
0
by: Jack Wu | last post by:
Hi I've spent a good majority of my day trying to figure out how to have PIL 1.1.5 working on my OSX 10.3.9_PPC machine. I'm still stuck and I have not gotten anywhere. Could somebody please...
1
by: Smokey Grindel | last post by:
I have a bitmap object I want to return as a JPEG image with a compression set at 90% and progressive passes enabled, how can I do this in .NET 2.0? Progressive passes are not necessary but the...
8
by: Lucas | last post by:
I need print a file in binary mode . f = f.open('python.jpg','rb') bytes = f.read() f.close() print(bytes) I can't get any binary code.
5
by: prakashturkar | last post by:
Hi, I am Prakash.... I have tried to print an MS Word file using the basic print utilities provided in JAVA.But while asking for printing through my own code i am getting proble for example..."The...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.