Printing an image from a console application

I am trying to find how to print an image (like on paper) in C #. I try to make it very simple. Therefore, you do not need to use WinForms and just use the console output.

I myself was looking for an answer, but could not understand any results.

+6
c # image printing console-application
source share
2 answers

You definitely do not need a WinForm print application. JUst use PrintDocument and DrawImage , and you can do something like this:

PrintDocument pd = new PrintDocument(); pd.PrintPage += (thesender, ev) => { ev.Graphics.DrawImage(Image.FromFile("Your Image Path"), //This is to keep image in margins of the Page. new PointF(ev.MarginBounds.Left,ev.MarginBounds.Top)); }; pd.Print(); 

Hope this helps. (I used Lambada and an anonymous delegate to handle the event, I donโ€™t understand that please say that I will publish the regular version)

+5
source share

Isn't it as simple as sending an image byte stream to the C # print library? just like you print any other document, as PDF says, which is actually a collection of images. And settings, such as alignment, layout, B / W, or color, will be specific to the printer.

+1
source share

All Articles