Search code examples
c#dpiprintdocument

PrintDocument default DPI value in C#?


I created some graphics to be printed assuming that the PrintDocument class uses the standard 96 dpi (an inch of the drawing requires 96 pixels on the printout), but when I print those graphics on paper they appear smaller thus not having the appropiate dimensions.

Sketch of the problem

So what is the default DPI value of the PrintDocument class?

Thanks in advance!


Solution

  • This answer is by Hans Passant:

    In your PrintPage event handler, the e.Graphics.PageUnit property is set to GraphicsUnit.Display. Which makes 100 "pixels" equal to one inch on paper. Regardless of the printer DPI. Close to the default DPI for the screen, not quite.