Link to home
Start Free TrialLog in
Avatar of kmullins5
kmullins5

asked on

How do I get the DPI of my printer using C#?

The question
-----------------------------------
How do I get the Printer's actual DPI? (Preferably using C# and .net 2.0 or earlier)

A little background information
--------------------------------------
I am trying to create a print dialog for an application. It needs to be able to print the images into standard photo sizes, which are listed in inches. The user is able to choose their Printer, Paper Size, and Print Quality. Based on the Print Quality, I figure I am going to have to scale my image so it will print to the correct dimensions.

The problem
-----------------------------------
On my printer, when I use the System.Drawing.Printing.PrintResolution.Kind variable to find the available Printer Resolutions, I get results back like High, Medium, Low, and Draft. When I look at the X and Y values of those, I get results like "-4" and "-2".

After further reading, I found that those are just enumerated standards and are part of the WinGDI.h file. However, I can't find out anywhere what they actually stand for.

So basically, from what I have read, the Print Qualities are just standards and should be as simple as saying Medium is 300 DPI. Unfortunately I can't find any information to back this idea up.
ASKER CERTIFIED SOLUTION
Avatar of Mikael Jansson
Mikael Jansson
Flag of Sweden image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
forgot to mention that you replace the printer name in the query, in this case it says 'amhome-p01' with your printer name.
actually you can probably replace the foreach section as its only one printer returned.
if you like to run this remotely you remove the single . (dot) in the first codeline after the \\\\ with the computer name you want to check.
/ Mikael
Nothing to add to the tech discussion, just a shout-out for the # of points offered.....