PageHeight、PageWidth-pixels of the currently printing page
XDPI、YDPI-pixel definition of the printer

解决方案 »

  1.   

    下面是人家的代码:function GetPhicalPaper: TPoint;
    var
      PageSize : TPoint;
    begin
      //PageSize.X; 纸张物理宽度-单位:点
      //PageSize.Y; 纸张物理高度-单位:点
      Escape(Printer.Handle, GETPHYSPAGESIZE, 0, nil, @PageSize);
      Result := PageSize;
    end;
    function XPointToMm(Pos: Integer): Extended;
    begin
    //横向点单位转换为毫米单位
      Result := Pos*25.4/HPointsPerInch;
    end;function YPointToMm(Pos: Integer): Extended;
    begin
    //纵向点单位转换为毫米单位
      Result := Pos*25.4/VPointsPerInch;
    end;
      

  2.   

    function HPointsPerInch: Integer;
    begin
    //取得水平方向每英寸打印机的点数
      Result := GetDeviceCaps(Printer.Handle, LOGPIXELSX);
    end;function VPointsPerInch: Integer;
    begin
    //取得纵向方向每英寸打印机的光栅数
      Result := GetDeviceCaps(Printer.Handle, LOGPIXELSY)
    end;function XPointToMm(Pos: Integer): Extended;
    begin
    //横向点单位转换为毫米单位
      Result := Pos*25.4/HPointsPerInch;
    end;function YPointToMm(Pos: Integer): Extended;
    begin
    //纵向点单位转换为毫米单位
      Result := Pos*25.4/VPointsPerInch;
    end;
      

  3.   

    Escape(Printer.Handle, GETPHYSPAGESIZE, 0, nil, @PageSize);这个是什么意识??我用ShowMessage(IntToStr(PageSize.x))为何显示为0???