This forum contains outdated content and is available for reading only. Please contact technical support if you have any questions.

Printing

Chris Herrington#688

Dmitry,

What is the best way to output an image to a printer from the viewer?

Thanks in advance

Chris
Fedor#3961
Hello Chris,

Chris Herrington (9/14/2005)

What is the best way to output an image to a printer from the viewer?


Let's me answer instead of Dmitry 🙂

The best way of printing images is to save them in PDF file and then stream it to browser.

On other side you can stream JPEG or PNG image to browser and then call window.print() method from JavaScript, however in this case you have almost no way to control settings.
Chris Herrington#3965
Have any samples of how to do that?

Thanks

Chris
Dmitry#3998
Hello Chris,

Here is a small code sample how to print image in the web application via PDF format:
Aurigma.GraphicsMill.Bitmap bitmap = new Aurigma.GraphicsMill.Bitmap(Server.MapPath("Images/1.jpg"));
try
{
    bitmap.Save(Response.OutputStream, new Aurigma.GraphicsMill.Codecs.PdfEncoderOptions());
}
finally
{
    bitmap.Dispose();
}

If you have some questions, please, feel free to contact us.