Get pixels per inch of printer

Posted in Devices

If you want to get number of pixels per inch of the current printer, then use GetDeviceCaps function.

uses Printers;
...
procedure TForm1.Button1Click(Sender: TObject);
begin
  Label1.Caption:=
    IntToStr(GetDeviceCaps(Printer.Handle, LogPixelsX));
  Label2.caption:=
    IntToStr(GetDeviceCaps(Printer.Handle, LogPixelsY));
end;