function SetPrinterScale(dpi : integer) : TPoint;
var
DeviceDpiX, DeviceDpiY : integer;
begin
with Printerdo
begin
SetMapMode(Handle, MM_ISOTROPIC);
windows.SetWindowExtEx(Handle, dpi, dpi, nil);
DeviceDpiX := GetDeviceCaps(Handle, LOGPIXELSX);
DeviceDpiY := GetDeviceCaps(Handle, LOGPIXELSY);
windows.SetViewportExtEx(Handle, DeviceDpiX, DeviceDpiY, nil);
Result := Point(PageWidth, PageHeight);
with Canvasdo
begin
DPtoLP(Handle, Result, 1);
Font.PixelsPerInch := DPI;
end;
end;
end;