1. 程式人生 > >LODOP整頁縮放,寬度、高度溢出縮放

LODOP整頁縮放,寬度、高度溢出縮放

打印控件 asc 寬高 lod color 全局 head class 溢出

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>

圖示:

技術分享圖片

LODOP整頁縮放,寬度、高度溢出縮放