您的当前位置:首页正文

Lodop6.1技术手册

2021-09-09 来源:客趣旅游网


WEB打印控件Lodop技术手册

Ver 6。1.1.8

Email: gungho999@sina.com

QQ: 932131686 梦泰尔软件工作室 MTSoftware(CN)

1

目 录

一、概述 ........................................................................................................................................................... 3 二、系统文件 ................................................................................................................................................... 4

install_lodop.exe ............................................................................................................................... 4 LodopFuncs.js ................................................................................................................................... 5

三、控件参数 ................................................................................................................................................... 7

Caption .............................................................................................................................................. 7 Color .................................................................................................................................................. 7 Border ................................................................................................................................................ 7

四、功能函数 ................................................................................................................................................... 8

1、基本函数 ............................................................................................................................................. 8

VERSION.......................................................................................................................................... 8 PRINT_INIT ..................................................................................................................................... 8 SET_PRINT_PAGESIZE .................................................................................................................. 9 ADD_PRINT_HTM ........................................................................................................................ 10 ADD_PRINT_TABLE .................................................................................................................... 10 ADD_PRINT_URL ......................................................................................................................... 12 ADD_PRINT_TEXT....................................................................................................................... 13 ADD_PRINT_IMAGE .................................................................................................................... 13 ADD_PRINT_RECT ...................................................................................................................... 14 ADD_PRINT_ELLIPSE ................................................................................................................. 15 ADD_PRINT_LINE ........................................................................................................................ 16 ADD_PRINT_BARCODE .............................................................................................................. 16 ADD_PRINT_CHART ................................................................................................................... 17 SET_PRINT_STYLE ...................................................................................................................... 18 PREVIEW ....................................................................................................................................... 20 PRINT ............................................................................................................................................. 20 PRINT_SETUP ............................................................................................................................... 21 PRINT_DESIGN ............................................................................................................................. 21 NEWPAGE ...................................................................................................................................... 21 GET_PRINTER_COUNT ............................................................................................................... 21 GET_PRINTER_NAME ................................................................................................................. 22 SET_PRINTER_INDEX ................................................................................................................. 22 SELECT_PRINTER ........................................................................................................................ 22 SET_SHOW_MODE ...................................................................................................................... 23 SET_PRINT_MODE ...................................................................................................................... 26 SET_PRINT_COPIES..................................................................................................................... 27 SET_PREVIEW_WINDOW ........................................................................................................... 27 ADD_PRINT_SETUP_BKIMG ..................................................................................................... 28 SEND_PRINT_RAWDATA ............................................................................................................ 28 WRITE_PORT_DATA .................................................................................................................... 28 READ_PORT_DATA ...................................................................................................................... 29 GET_PRINT_INIFFNAME ............................................................................................................ 29

2

GET_PAGESIZES_LIST ................................................................................................................ 30 WRITE_FILE_TEXT ...................................................................................................................... 30 GET_FILE_TEXT .......................................................................................................................... 30 GET_FILE_TIME ........................................................................................................................... 31 IS_FILE_EXIST .............................................................................................................................. 31 GET_SYSTEM_INFO .................................................................................................................... 31 GET_VALUE .................................................................................................................................. 32 FORMAT ......................................................................................................................................... 35 GET_DIALOG_VALUE ................................................................................................................. 36 2、扩展函数 ........................................................................................................................................... 37

PRINT_INITA ................................................................................................................................. 37 ADD_PRINT_HTML ..................................................................................................................... 37 ADD_PRINT_TBURL .................................................................................................................... 38 ADD_PRINT_TEXTA .................................................................................................................... 38 SET_PRINT_STYLEA ................................................................................................................... 38 SAVE_TO_FILE ............................................................................................................................. 42 SET_SAVE_MODE ........................................................................................................................ 43 ADD_PRINT_SHAPE .................................................................................................................... 44 SET_PRINTER_INDEXA .............................................................................................................. 45 NEWPAGEA ................................................................................................................................... 45 PREVIEWA ..................................................................................................................................... 46 PREVIEWB .................................................................................................................................... 46 PRINTA ........................................................................................................................................... 46 PRINTB ........................................................................................................................................... 46 SHOW_CHART .............................................................................................................................. 47 DO_ACTION .................................................................................................................................. 47 SET_LICENSES ............................................................................................................................. 48

五、软件使用权注册 ..................................................................................................................................... 48

CompanyName ................................................................................................................................ 49 License ............................................................................................................................................ 49 LicenseA.......................................................................................................................................... 49 LicenseB .......................................................................................................................................... 49

六、打印维护和打印设计 ............................................................................................................................. 50 七、使用样例 ................................................................................................................................................. 50 八、计量单位 ................................................................................................................................................. 51

一、概述

Lodop是一款专业的WEB打印控件,其设计目标是简单易用、功能足够强大,开创WEB打印开发的新局面.

Lodop设计者对WEB下的打印开发任务进行了分类汇总,高度抽象,设计出仅用几个

3

功能函数,就可实现复杂的打印任务,尽量减少使用者的知识累赘。控件发布包有3个系统文件组成,全部功能用几个控件参数和2组功能函数来实现。

尽管我们有个理想化的目标,那就是您不用详细了解这些参数或函数,仅仅看懂几个

样例文件就能很轻松地开始使用本控件,为此Lodop提供了一个足够完善的设计界面,用它可以实现大多数打印开发任务,但事实上了解这些参数和函数总还是有好处的,特别是当您的开发任务很复杂时,这就是本文目的,但愿本文档足够详细且简单明了。

如果此前曾看过lodop的入门样例程序,本文会更容易理解!

二、系统文件

Lodop发布包内主要有如下几个文件:

install_lodop。exe

该文件是控件安装和升级的主文件,有install_lodop32。exe(适用于32位浏览器)和install_lodop64。exe(适用于64位浏览器)两个程序,提供给用户或开发者下载安装,如果不特意拦截一般都能100%安装,对“网页插件安装难”有彻底改善。如果将其复制或改名为uninstall_lodop32。exe (名前加un)就可用其卸载控件.

Lodop安装后,在操作系统Program Files\\MountTaiSoftware\\Lodop目录下会生成两个实体文件:CAOSOFT_WEB_PRINT_LODOP。OCX和NPCAOSOFT_WEB_PRINT_LODOP.DLL 前一个文件是OCX文件,后者是NPplugin文件,其作用是实现多浏览器支持。目前Lodop支持IE系列、IE内核系列(遨游、360、世界之窗、腾讯TT、搜狗等)浏览器,以及Firefox(火狐)系列、Chrome(谷歌)系列、Opera系列、Safari系列等Windows下几乎所有的浏览器。

安装程序文件有几个预定参数:

-waitXX 该参数设置安装程序运行完毕后自动关闭窗口,这里的XX表示关闭前等待的秒数,如果是0秒则安装(或卸载)成功后立即关闭,例如: –wait8

—nowindow 该参数设置安装程序运行时不出现窗口。 —un 该参数使程序执行卸载操作,参数优先于文件名。 —in 该参数使程序执行安装操作,参数优先于文件名。

安装界面如下:

4

LodopFuncs.js

该文件是用来引导安装控件的一个JS文件,是个样例,但建议直接采用。其中getLodop的任务是判断当前浏览器的类型并决定采用哪个对象实例,并检测控件是否安装、是否最新版本、并引导安装或升级。文件内容如下:

function getLodop(oOBJECT,oEMBED){ /**************************

本函数根据浏览器类型决定采用哪个对象作为控件实例: IE系列、IE内核系列的浏览器采用oOBJECT,

其它浏览器(Firefox系列、Chrome系列、Opera系列、Safari系列等)采用oEMBED, 对于64位浏览器指向64位的安装程序install_lodop64。exe。 **************************/

var strHtmInstall=”打印控件未安装!点击这里〈a href='install_lodop32.exe’>执行安装,安装后请刷新页面或重新进入。〈/font〉”;

var strHtmUpdate=\"〈br>〈font color=’#FF00FF’>打印控件需要升级!点击这里〈a href='install_lodop32.exe'〉执行升级var strHtm64_Install=”〈br〉注意:
1:如曾安装过Lodop旧版附件npActiveXPLugin,请在【工具】—〉【附加组件】-〉【扩展】中先卸它。”; var LODOP=oEMBED;

try{

if (navigator。appVersion。indexOf(”MSIE\")>=0) LODOP=oOBJECT; if ((LODOP==null)||(typeof(LODOP。VERSION)==”undefined”)) {

if (navigator.userAgent.indexOf('Firefox’)〉=0) if (navigator.userAgent.indexOf(’Win64’)>=0){

if (navigator.appVersion。indexOf(\"MSIE”)〉=0) document.write(strHtm64_Install); else document。documentElement.innerHTML=strHtm64_Install+document。documentElement。innerHTML;if (navigator.appVersion.indexOf(\"MSIE”)〉=0) document.write(strHtmInstall); else

document。documentElement。innerHTML=strHtmFireFox+document。documentElement.innerHTML;

} else {

5

}

document.documentElement。innerHTML=strHtmInstall+document.documentElement。innerHTML;

return LODOP;

if (navigator.userAgent。indexOf(’Win64')>=0){

document.documentElement。innerHTML=strHtm64_Update+document.documentElement。innerHTML; } else {

document。documentElement。innerHTML=strHtmUpdate+document。documentElement.innerHTML; }

return LODOP;

} else if (LODOP。VERSION<”6.1。0.9”) {

if (navigator.appVersion。indexOf(\"MSIE\")〉=0) document.write(strHtm64_Update); else

if (navigator.appVersion.indexOf(\"MSIE”)〉=0) document.write(strHtmUpdate); else

}

//*****如下空白位置适合调用统一功能:*********

//******************************************* return LODOP; }catch(err){

if (navigator。userAgent。indexOf('Win64')>=0)

document.documentElement.innerHTML=”Error:\"+strHtm64_Install+document.documentElement。innerHTML;

document。documentElement。innerHTML=\"Error:\"+strHtmInstall+document。documentElement。

else innerHTML;

return LODOP; }

其中的关键点是VERSION函数,Lodop提供了这个“读版本号\"功能,这样控件的安装和升级任务就交给JS来实现,以下是控件在页面内的调用代码,其中包含getLodop的使用: