CAD在网页中打印的图纸里面添加页眉及页脚

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//添加一个页眉或页脚数据
 
    //新建一个COM组件对象 参数为COM组件类名
    var getPt = mxOcx.NewComObject("IMxDrawUiPrPoint");
 
    getPt.message = "点取打印范围第一点";
 
    if (getPt.go() != 1) {
        return;
    }
    var frstPt = getPt.value();
    if (frstPt == null)
        return;
    //新创建IMxDrawUtility对象
    var utl = mxOcx.NewUtility();
    //与用户交互得一个矩形框  参数一矩形框一个对角点;参数二命令行提示
    var secondPt = utl.GetCorner(frstPt, "点取打印范围第二点");
    if (secondPt == null)
        return;
    //新建一个COM组件对象 参数为COM组件类名
    var print = mxOcx.NewComObject("IMxDrawPrint");
    //添加一个页眉或页脚数据
    // 参数一为打印的文字内容;参数二为字体;参数三为字体大小,单位是mm ;参数四为字体位置
    print.AddPageComment("TTTTTT中文", "宋体", 3, 1);
    print.AddPageComment("TTTTTT中文", "宋体", 3, 2);
    print.AddPageComment("TTTTTT中文", "宋体", 3, 3);
    print.AddPageComment("TTTTTT中文2", "宋体", 3, 4);
    print.AddPageComment("TTTTTT中文2", "宋体", 3, 5);
    print.AddPageComment("TTTTTT中文2", "宋体", 3, 6);
    //开始打印  参数一为打印的范围左下角X1;参数二为打印的范围左下角Y1
    //参数三为打印的范围右上角X2 ;参数四为打印的范围右上角Y2
    if (print.Print(frstPt.x, frstPt.y, secondPt.x, secondPt.y)) {
        alert("打印成功");
    }
    else {
        alert("打印失败");
    }

版权声明:本文为yzy0224原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://www.cnblogs.com/yzy0224/p/10996032.html