//需要引用 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;