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

printing a file ...

What code must i use to print a specific file image (picture.jpg) ?
Feb 6 '07 #1
6 1211
"giannis" <zz********@freemail.grschrieb
What code must i use to print a specific file image (picture.jpg) ?
Windows Forms Print Support:
http://msdn2.microsoft.com/en-us/lib...58(VS.80).aspx

Sub topic "How to: Print Graphics in Windows Forms":
http://msdn2.microsoft.com/en-us/lib...tc(vs.80).aspx
Working with images:
http://msdn2.microsoft.com/en-us/library/a343dky2.aspx
http://msdn2.microsoft.com/en-us/library/3ke1f63h.aspx
Armin
Feb 6 '07 #2
I want to press a button and print a specific image file.
What code must i write for this ?
I dont want to print a form or an image on a form ...
Feb 6 '07 #3
"giannis" <zz********@freemail.grschrieb
I want to press a button and print a specific image file. What code
must i write for this ?
I dont want to print a form or an image on a form ...

It takes some time to learn how to do it. The links I provided supply all
the information you need, not only how to print a Form. Sorry, I don't write
the code for you.
Armin

Feb 6 '07 #4
Is it correct ?
PrintDocument1.DocumentName = "c:\picture.jpg"

PrintDocument1.Print()
Feb 6 '07 #5
"giannis" <zz********@freemail.grschrieb:
Is it correct ?
PrintDocument1.DocumentName = "c:\picture.jpg"

PrintDocument1.Print()

No. Add a handler to the 'PrintDocument' object's 'PrintPage' event and
place the code below in the event handler:

\\\
Using img As Image = Image.FromFile("C:\picture.jpg")
e.Graphics.DrawImage(img, ...)
End Using
///

Then simply call the 'PrintDocument''s 'Print' method.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

Feb 6 '07 #6
"giannis" <zz********@freemail.grschrieb
Is it correct ?
PrintDocument1.DocumentName = "c:\picture.jpg"

PrintDocument1.Print()

You obviously don't bother reading the documentation. In order to learn, I
had to do it also on my own. Though, let me try to put it together:

This page shows how to print:

http://msdn2.microsoft.com/en-us/lib...tc(vs.80).aspx

The principle is to use e.graphics to paint on it. In this case it's
"painted" on the printer, not on the screen. How to load an image and how to
paint it on a Graphics object is shown here:

http://msdn2.microsoft.com/en-us/library/sb2z5bb0.aspx

In your case, in the event handler of the PrintPage event, use the Graphics
object passed in e.graphics to paint the image.
Armin

Feb 6 '07 #7

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

Similar topics

4
by: Jody Gelowitz | last post by:
I am having a problem with printing selected pages. Actually, the problem isn't with printing selected pages as it is more to do with having blank pages print for those pages that have not been...
9
by: Jody Gelowitz | last post by:
I am trying to find the definition of "Safe Printing" and cannot find out exactly what this entitles. The reason is that I am trying to print contents from a single textbox to no avail using the...
0
by: DotNetDummy | last post by:
Hi all, I am trying to set the printing setting e.g duplex mode etc. on a default printer when I.E object started printing a particular html doc. Here's the partial code, any help would be...
5
by: Patrick De Ridder | last post by:
How can I turn what I want to print 90 degrees using the logic below? Please tell me the code with which to make the modification. Many thanks, Patrick. using System.ComponentModel; using...
6
by: Bruno Hardmeier | last post by:
Hi How can I redirect a print job to a file? There is a checkbox in the print dialog, but I would like to do it in code indicating a filename. Thanks Bruno Hardmeier
4
by: Rob T | last post by:
I have a small VB program that has a printing module...very simple....and works great. However, If I try to print to a generic printer, I get the following error: "The data area passed to a...
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...
8
by: Neo Geshel | last post by:
Greetings. BACKGROUND: My sites are pure XHTML 1.1 with CSS 2.1 for markup. My pages are delivered as application/xhtml+xml for all non-MS web clients, and as text/xml for all MS web...
2
by: coldblood22 | last post by:
Well in my Application i am using the java Printable interface to print the GUI. The printing is done fine but once done with the printing my program breaks off with the database file without. Well...
18
by: Brett | last post by:
I have an ASP.NET page that displays work orders in a GridView. In that GridView is a checkbox column. When the user clicks a "Print" button, I create a report, using the .NET Framework printing...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.