473,413 Members | 1,807 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,413 software developers and data experts.

Print an image file from VB

Hi

I am looking for sample code to print an image file from VB code image can
be .jpg, .bmp etc.

Thank you in advance,

Shmuel Shulman
Nov 21 '05 #1
1 21549
Hi,

Here is a quick example. Add a button and printdocument to your
form. This will print the file camera.bmp. Hope this helps

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub

Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object,
ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles
PrintDocument1.PrintPage
Dim g As Graphics = e.Graphics

g.DrawImage(Image.FromFile("C:\camera.bmp"), 5, 5)
End Sub

Ken
---------------
"S Shulman" <sm*******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi

I am looking for sample code to print an image file from VB code image can
be .jpg, .bmp etc.

Thank you in advance,

Shmuel Shulman

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

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...
1
by: weiwei | last post by:
HI I am having a problem with print friendly function with asp, I have download some code regard with print friendly, it works fine with static html information, however, I have the dynamic pages...
2
by: Kitkat | last post by:
Hi, i hope my english is good enough to explain my problem. Okay, I have a html-file with a image. But i don't want to save or print the html-file with the image. I want to save or print a...
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...
3
by: Edward | last post by:
Hi, I have one image file, when users load it, they can choose whether to print it, in general print result, there'll always be one PageHead telling number of total pages and one PageFooter...
1
by: hamil | last post by:
I am trying to print a graphic file (tif) and also use the PrintPreview control, the PageSetup control, and the Print dialog control. The code attached is a concatination of two examples taken out...
9
by: Scott M | last post by:
I'm printing a directory of about 500 multi-page tifs to a high speed printer and the spooler process is killing me!!! here is a little code..... Public Function PrintImage(ByVal...
5
by: Brad Pears | last post by:
I have the following code which I was using to print .pdf's. It worked fine and actually printed the pdf file. Now I want to use the same code to print a .jpg file. When I run the code, it...
2
by: yogarajan | last post by:
hi i have create one html file. That file contains background image . but print preview time not display . i am go to tools -> internet options-> advanced options -> printing -> print background...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.