• LODOP整页缩放,宽度、高度溢出缩放


    LODOP中,超文本超过打印项高度会自动分页,可以用语句进行缩放,让打印内容都在一页中。
    例如,整页缩放和高度溢出缩放。
    如下是三个语句及其效果,注意对内容缩放可能会导致变形哦,毕竟是不等比例缩放:
    LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT","Full-Page");//整页缩放
    效果:宽高都会缩放,缩放到整页里面。
    LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);//宽度溢出缩放
    效果:宽度超过纸张,把宽度缩放到合适到纸张里,高度超过纸张,高度不会缩放。
    LODOP.SET_PRINT_MODE("FULL_HEIGHT_FOR_OVERFLOW",true);//高度溢出缩放
    效果:高度超过纸张,把高度缩放到适合纸张的高度,宽度超过纸张不会缩放。
    测试代码:

    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>WEB打印控件LODOP</title>
    <script language="javascript" src="LodopFuncs.js"></script>
    </head>
    <body>
    <a href="javascript:prn1_preview()">打印预览</a><br>
    <a href="javascript:prn2_preview()">打印预览整页缩放</a><br>
    <a href="javascript:prn3_preview()">打印预览宽度溢出缩放</a><br>
    <a href="javascript:prn4_preview()">打印预览高度溢出缩放</a><br>
    <script language="javascript" type="text/javascript">   
            var LODOP; //声明为全局变量 
        function prn1_preview() {
            LODOP=getLodop(); 
            LODOP.PRINT_INIT("");
            LODOP.ADD_PRINT_LINE("34.4mm","82.81mm","34.1mm","101.31mm",0,1);
            LODOP.ADD_PRINT_URL(0,0,"100%","100%","http://www.c-lodop.com/index.html");    
            LODOP.PRINT_DESIGN();
            //LODOP.PREVIEW();    
        };
        function prn2_preview() {
            LODOP=getLodop(); 
            LODOP.PRINT_INIT("");
            LODOP.ADD_PRINT_URL(0,0,"100%","100%","http://www.c-lodop.com/index.html");    
            LODOP.SET_PRINT_MODE("PRINT_PAGE_PERCENT","Full-Page");
            LODOP.PRINT_DESIGN();
            //LODOP.PREVIEW();    
        };
        function prn3_preview() {
            LODOP=getLodop(); 
            LODOP.PRINT_INIT("");
            LODOP.ADD_PRINT_URL(0,0,"100%","100%","http://www.c-lodop.com/index.html");    
            LODOP.SET_PRINT_MODE("FULL_WIDTH_FOR_OVERFLOW",true);
            LODOP.PRINT_DESIGN();
            //LODOP.PREVIEW();    
        };
        function prn4_preview() {
            LODOP=getLodop(); 
            LODOP.PRINT_INIT("");
            LODOP.ADD_PRINT_URL(0,0,"100%","100%","http://www.c-lodop.com/index.html");    
            LODOP.SET_PRINT_MODE("FULL_HEIGHT_FOR_OVERFLOW",true);
            LODOP.PRINT_DESIGN();
            //LODOP.PREVIEW();    
        };
            
    </script> 
    </body>

    图示:

  • 相关阅读:
    让.Net程序支持命令行启动
    拒绝卡顿——在WPF中使用多线程更新UI
    比NPOI更好用的Excel操作库——EPPlus
    利用Visual Studio Natvis 框架简化C++的变量调试工作
    使用LibZ合并.Net程序集,支持WPF
    SONY新的圈铁耳机
    找回VisualStudio异常设置中丢失的“用户未处理的(User-unhandled)”列
    去除下载文件属性中烦人的锁定状态
    POJ 3347 Kadj Squares
    POJ 1696 Space Ant(极角排序)
  • 原文地址:https://www.cnblogs.com/huaxie/p/10594097.html
Copyright © 2020-2023  润新知