SuperMap iObjects .NET 11i 知识库
地图排版打印  

8     布局打印指南

8.1     如何打印系统预定义模板和用户自定义模板

1.     注意:系统预定义纸张,它的宽和高是定值,所以不用给Printer的宽和高赋值,否则会报错;

2.     如何判断当前要打的布局是用户自定义还是系统预定义的:

3.     系统预定义模板打印代码示例:

                  // 预定义模板不用给 Printer 赋值宽和高两个参数,因为预定义模板的宽,高是定值

                  // 第一句将Paper.Size赋值给Printer.PaperSize,就包含着赋值了宽和高

                  MapLayout.Printer.PaperSize = MapLayout.Paper.Size;

                  MapLayout.Printer.Orientation = MapLayout.Paper.Orientation;

                  MapLayout.Printer.Margin = MapLayout.Paper.Margin;

                  MapLayout.Printer.IsVectorPrint = false;

                  MapLayout.PrintPreview = true;

4.     用户自定义模板打印代码示例:

                  MapLayout.Printer.PaperSize = MapLayout.Paper.Size;

                  MapLayout.Printer.Orientation = MapLayout.Paper.Orientation;

                  MapLayout.Printer.PaperWidth = MapLayout.Paper.Width;

                  MapLayout.Printer.PaperHeight = MapLayout.Paper.Height;

                  MapLayout.Printer.Margin = MapLayout.Paper.Margin;

                  MapLayout.Printer.IsVectorPrint = false;

                  MapLayout.PrintPreview = true;

8.2     如何分页打印

1.     如何设置是否分页打印:

是否分页打印是通过给 Printer 赋值不同的PaperSize来区分的

2.     分页打印代码示例:

将宽 1.7米,高1米的用户自定义布局,用A4分页打印出来

代码如下:

                  MapLayout.Printer.PaperSize = PaperSize.A4;

                  MapLayout.Printer.Orientation = MapLayout.Paper.Orientation;

                  MapLayout.Printer.Margin = MapLayout.Paper.Margin;

                  MapLayout.Printer.IsVectorPrint = false;

                  MapLayout.PrintPreview = true;

注意事项:

代码如下:

                  MapLayout.Printer.PaperSize = PaperSize.A4;

                  MapLayout.Printer.Orientation = (按照自己想要的横纵向设置一个值);

                  MapLayout.Printer.Margin = (按照自己想要的页边距设置一个值);

代码如下:

                  MapLayout.Printer.PaperSize = PaperSize.A4;

                  MapLayout.Printer.Orientation = MapLayout.Paper.Orientation;(使用原布局的横纵向)

                  MapLayout.Printer.Margin = MapLayout.Paper.Margin;(使用原布局的页边距)

打印分成的第1张小页,代码如下:

                  MapLayout.Printer.PaperSize = PaperSize.A4;

                  MapLayout.Printer.FromPage = 1;

                  MapLayout.Printer.ToPage = 1;

                  MapLayout.Printer.Orientation = MapLayout.Paper.Orientation;

                  MapLayout.Printer.Margin = MapLayout.Paper.Margin;

打印分成的第3张小页到第12张小页,代码如下:

                  MapLayout.Printer.PaperSize = PaperSize.A4;

                  MapLayout.Printer.FromPage = 3;

                  MapLayout.Printer.ToPage = 12;

                  MapLayout.Printer.Orientation = MapLayout.Paper.Orientation;

                  MapLayout.Printer.Margin = MapLayout.Paper.Margin;

3.     按布局原大小打印代码示例:

将宽 1.7米,高1米的用户自定义布局,按原布局打印,代码如下:

                  MapLayout.Printer.PaperSize = MapLayout.Paper.Size;

                  MapLayout.Printer.Orientation = MapLayout.Paper.Orientation;

                  MapLayout.Printer.PaperWidth = MapLayout.Paper.Width;

                  MapLayout.Printer.PaperHeight = MapLayout.Paper.Height;

                  MapLayout.Printer.Margin = MapLayout.Paper.Margin;

                  MapLayout.Printer.IsVectorPrint = false;

                  MapLayout.PrintPreview = true;

 


  版权所有© 北京超图软件股份有限公司。保留所有权利。