打印机类。
命名空间:
SuperMap.Layout程序集: SuperMap.Layout (in SuperMap.Layout)
版本: dll
语法
C# |
---|
public class Printer |
示例
以下代码示范了如何将布局进行打印输出。
下面函数操作的工作空间为安装目录\SampleData\changchun\下的 changchun 工作空间,工作空间中存在一个名为 Layout_Changchun 的布局。
CopyC#
public void TestPrinterExample(MapLayout mapLayout, Workspace workspace) { //打开工作空间中已经存在的布局 mapLayout.Workspace = workspace; mapLayout.Open("Layout_Changchun"); //获取布局的打印机对象,并对其进行设置 Printer printer = mapLayout.Printer; printer.PaperSize = PaperSize.A4; printer.Orientation = PaperOrientation.Landscape; PaperMargin paperMargin = new PaperMargin(70); paperMargin.Left = 100; paperMargin.Right = 100; printer.Margin = paperMargin; printer.DeviceDPI = 72; printer.IsVectoPrint=true; printer.PrinterName = @"\\192.168.115.123\HPLaserJ"; //打印布局 if (printer.IsValidPrinter) { printer.Print(); } else { MessageBox.Show("Fail. The Printer is invalid."); } }
继承层次
System..::.Object
SuperMap.Layout..::.Printer
SuperMap.Layout..::.Printer