1

A simple question - If I want to print a picture so it best fits the page in C#, do I have to scale it to the dimensions of the page myself ?

I've noticed the many good answers about how-to scale, I just want to know If I need to scale myself, as the scaling isn't a part of an image processing, it's only for the sake of the printing.

(a simple yes (if it's the answer) would do)

Edit: Currently I'm scaling using:

e.Graphics.DrawImage(my_image, destRect, srcRect, GraphicsUnit.Pixel);

Whereas destRect is a rectangle of the dimensions of the wanted output, I've done a simple algorithm to set this destRect to optimal sizes while preserving the original aspect ratio. (btw I'm not happy with this simple scaling, as it lacks in Image quality, will probably update to something fancier if I must).

But I've wanted to know if there's some auto-scaling provided by the framework for printing purposes, I really don't want to re-invent this wheel..

Community
  • 1
  • 1
Liran Orevi
  • 4,755
  • 7
  • 47
  • 64
  • @Phoexo, if I send a picture in a specific way, it isn't optimally scaled. This kind of attempt however doesn't assure me that a better way doesn't exist. (I do know of complex ways, that is to scale the picture myself, which is what I'm currently doing, edited about it, but I want to make sure there isn't a better way). – Liran Orevi Sep 20 '09 at 22:20

1 Answers1

2

I'm not sure if this is as simple as yes/no. I suspect that you must still use GDI+ and the Graphics object, so scaling is as simple as calling Graphics.DrawImage(...) on the graphics object for the printing device. Some printer drivers might support scaling the source automatically, though.

Cecil Has a Name
  • 4,962
  • 1
  • 29
  • 31