Delphi ArcEngine 打印PageControl内容

//需要引用 printer,windows 单元
function PrintLayoutMap(pPageLayout: TPageLayoutControl): Boolean;
var
  pPrinter: IPrinter;
  pPaper: IPaper;
  pPage: IPage;
begin
  if Printer.Printers.Count > 0 then
  begin
    pPrinter := pPageLayout.Printer;
    pPaper := pPrinter.Paper;
    pPage := pPageLayout.Page;

    //设置页面尺寸,A4
    pPage.FormID := esriPageFormA4;

    //打印方向
    pPage.Orientation := 1;

    //匹配值
    pPage.PageToPrinterMapping := esriPageMappingScale;

    if pPaper.Orientation <> pPage.Orientation then
    begin
      pPaper.Orientation := pPage.Orientation;
    end;

    pPageLayout.PrintPageLayout(1, 1, 0);
    Result := True;
  end
  else
  begin
    MessageBox(0, '没有连接好打印机设备!', '提示', MB_OK + MB_ICONWARNING + MB_DEFBUTTON2);
    Result := False;
  end;
end;
posted on 2009-03-30 21:22  知真道  阅读(456)  评论(0编辑  收藏  举报