Lodop绘制条码图功能让条码打印变得很简单,客户端不用安装专门的条码字库,该函数格式如下:
ADD_PRINT_BARCODE(Top,Left,Width,Height,BarCodeType,BarCodeValue);
关键参数含义:
Width 条码的总宽度,计量单位px(1px=1/96英寸)
Height 条码的总高度(一维条码时包括文字高度)
BarCodeType 条码的类型(规制)名称
BarCodeValue 条码值
目前控件支持的条码类型有如下26种,包含24种一维码和2种二维码:
128A 128B 128C 128Auto EAN8 EAN13 |
EAN128A EAN128B EAN128C Code39 39Extended 2_5interleaved |
2_5industrial 2_5matrix UPC_A UPC_E0 UPC_E1 UPCsupp2 |
UPCsupp5 Code93 93Extended MSI PostNet Codabar |
QRCode PDF417 |
演示各种条码(条形码及二维码的生成)
注意:打印设计中改变对象区域大小时,条码会自动随之适应调整,也可以360度范围随便定义旋转方向。
双击对象,在弹出的属性窗口中修改其它属性,然后生成程序代码看看其实现方法。
示例代码:
<input type="button" value="打印预览" name="B3" onclick="prn_Preview()">
function prn_Preview() {
CreatePrintPage();
LODOP.PREVIEW();
};
function CreatePrintPage() {
LODOP=getLodop(document.getElementById('LODOP1'),document.getElementById('LODOP_EM1'));
LODOP.PRINT_INITA(0,0,800,1600,"打印控件功能演示_Lodop功能_打印条码");
LODOP.ADD_PRINT_BARCODE(28,34,307,47,"128A","123456789012");
LODOP.ADD_PRINT_BARCODE(88,32,206,78,"128B","123456789012");
LODOP.SET_PRINT_STYLEA(0,"FontSize",18);
LODOP.ADD_PRINT_BARCODE(107,255,161,64,"128C","888888");
LODOP.SET_PRINT_STYLEA(0,"Color","#FF0000");
LODOP.ADD_PRINT_BARCODE(179,42,130,47,"128Auto","12345678901");
LODOP.ADD_PRINT_BARCODE(252,42,153,54,"EAN8","12345678");
LODOP.SET_PRINT_STYLEA(0,"Angle",180);
LODOP.ADD_PRINT_BARCODE(173,244,235,172,"EAN13","1234567890123");
LODOP.SET_PRINT_STYLEA(0,"Angle",35);
LODOP.ADD_PRINT_BARCODE(351,34,360,36,"EAN128A","123456789012");
LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
LODOP.ADD_PRINT_BARCODE(403,34,360,47,"EAN128B","123456789012");
LODOP.SET_PRINT_STYLEA(0,"AlignJustify",2);
LODOP.ADD_PRINT_BARCODE(462,34,360,47,"EAN128C","123456789012");
LODOP.ADD_PRINT_BARCODE(513,34,360,47,"Code39","*123ABC4567890*");
LODOP.SET_PRINT_STYLEA(0,"Color","#0000FF");
LODOP.ADD_PRINT_BARCODE(570,34,360,47,"39Extended","*1234567890*");
LODOP.ADD_PRINT_BARCODE(621,34,360,47,"2_5interleaved","123456789012");
LODOP.ADD_PRINT_BARCODE(677,34,360,47,"2_5industrial","123456789012");
LODOP.ADD_PRINT_BARCODE(729,34,360,47,"2_5matrix","123456789012");
LODOP.SET_PRINT_STYLEA(0,"Color","#408080");
LODOP.ADD_PRINT_BARCODE(787,34,360,47,"UPC_A","089600124569");
LODOP.ADD_PRINT_BARCODE(844,34,135,64,"UPC_E0","08960007");
LODOP.ADD_PRINT_BARCODE(65,595,45,95,"UPC_E1","1122333");
LODOP.SET_PRINT_STYLEA(0,"Angle",90);
LODOP.ADD_PRINT_BARCODE(87,676,57,122,"UPCsupp2","12345");
LODOP.SET_PRINT_STYLEA(0,"Angle",90);
LODOP.ADD_PRINT_BARCODE(359,435,78,181,"UPCsupp5","123456789012");
LODOP.SET_PRINT_STYLEA(0,"Angle",90);
LODOP.ADD_PRINT_BARCODE(309,579,44,238,"Code93","BJ100080");
LODOP.SET_PRINT_STYLEA(0,"Angle",90);
LODOP.ADD_PRINT_BARCODE(241,663,73,246,"93Extended","123456789012");
LODOP.SET_PRINT_STYLEA(0,"Angle",-90);
LODOP.ADD_PRINT_BARCODE(583,419,58,251,"MSI","123456789012");
LODOP.SET_PRINT_STYLEA(0,"Color","#FF00FF");
LODOP.SET_PRINT_STYLEA(0,"ShowBarText",0);
LODOP.SET_PRINT_STYLEA(0,"Angle",90);
LODOP.ADD_PRINT_BARCODE(589,504,74,270,"PostNet","123456789012");
LODOP.SET_PRINT_STYLEA(0,"Angle",90);
LODOP.ADD_PRINT_BARCODE(565,626,115,253,"Codabar","123456789012");
LODOP.SET_PRINT_STYLEA(0,"Angle",285);
LODOP.ADD_PRINT_BARCODE(30,405,176,67,"PDF417","我是pdf417value");
LODOP.ADD_PRINT_BARCODE(130,434,168,146,"QRCode","1234567890版本7的最大值是122个字符123123");
LODOP.SET_PRINT_STYLEA(0,"GroundColor","#0080FF");
};
以上就是LODOP演示如何打印条形码的详细内容,更多关于LODOP演示如何打印条形码的资料请关注九品源码其它相关文章!