Need to know current printer PPI

Please discuss general Delphi programming topics here.

Need to know current printer PPI

Postby GfxBro » July 1st, 2011, 12:44 pm

How to get printer PPI? I'm using TPrintPreview. I know how to get vert/hor DPI, but don't know how to PPI?
GfxBro
Member
Member
 
Posts: 2
Joined: July 1st, 2011, 12:34 pm

Re: Need to know current printer PPI

Postby Kambiz » July 1st, 2011, 11:53 pm

Does PPI stand for pixels per inch?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm

Re: Need to know current printer PPI

Postby GfxBro » July 2nd, 2011, 7:32 am

Yes, pixels per inch or pixel density. I checked formula here:

http://en.wikipedia.org/wiki/Pixel_density

and wrote this:

Code: Select all
  dp := Round(Sqrt(Sqr(PrintPreview1.PageDevicePixels.X) + Sqr(PrintPreview1.PageDevicePixels.Y)));
  di := Round(Sqrt(Sqr(PrintPreview1.PageDevicePixels.X div GetDeviceCaps(PrintPreview1.Printer.Handle, LOGPIXELSX)) + Sqr(PrintPreview1.PageDevicePixels.Y div GetDeviceCaps(PrintPreview1.Printer.Handle, LOGPIXELSY))));
  ppi := dp div di;


but looks to be wrong :(
GfxBro
Member
Member
 
Posts: 2
Joined: July 1st, 2011, 12:34 pm

Re: Need to know current printer PPI

Postby Kambiz » July 2nd, 2011, 10:41 am

DPI and PPI are synonyms.

PrintPreview works independent of printer's resolution.
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2429
Joined: March 7th, 2003, 7:10 pm


Return to Delphi Programming

Who is online

Users browsing this forum: No registered users and 5 guests

cron