=================================
delphi:
myLodop:=TLodopX.create(Self);
myLodop.Parent:=myPanel;
myLodop.Height:=myPanel.Height;
myLodop.Width:=myPanel.Width;
myLodop.PRINT_INIT('');
myLODOP.ADD_PRINT_TEXT(10,10,100,20,'新加文本1');
myLODOP.ADD_PRINT_RECT(66,116,100,60,0,1);
myLodop.SET_SHOW_MODE('DESIGN_IN_BROWSE','1');
myLodop.print_design;
=================================
VB:
Private Sub Command1_Click()
With LodopX1
.PRINT_INIT ""
.ADD_PRINT_TEXT 10, 10, 20, 20, "aaaa"
.PREVIEW
End With
End Sub
=================================
C#:
首先添加引用文件:CAOSOFT_WEB_PRINT_lodop.ocx
Lodop.LodopXClass MyLodop = new Lodop.LodopXClass();
MyLodop.ADD_PRINT_TEXT(10,10,100,20,"新加文本1");
MyLodop.PREVIEW();
=================================
C++:
首先添加引用文件:CAOSOFT_WEB_PRINT_lodop.ocx
int a = 5;
_variant_t var;
var = (_variant_t)(int)a;
VARIANT v = var;
CString str = _T("xxx");
_variant_t varText = (LPCTSTR)str;
VARIANT dispText = varText;
lodop.ADD_PRINT_TEXT(v,v,v,v,dispText);
lodop.PREVIEW();
=================================
VC:
_variant_t bstrVar("abcdef");
C# :引用CAOSOFT_WEB_PRINT_lodop.ocx
在C:\Program Files (x86)\MountTaiSoftware\Lodop
引用后会有ILodopX接口、ILodopXEvents接口,LodopX接口,LodopXClass类。
Lodop.LodopX PRLodop = new LodopX();
PRLodop.ADD_PRINT_TEXT(10, 10, 100, 20, "一个文本项");
PRLodop.SET_PRINT_STYLEA(0, "FontSize", 13.5);
PRLodop.SET_PRINT_STYLEA(0, "Bold", 1);
PRLodop.PREVIEW();
}
=================================
JAVA:
/**
* Java调用lodop直接打印
* 需要引入jacob-1.17.jar包。
*
* @author TonyTan
* @version 1.0, 2017-3-9
*/
public class JavaLodop {
public static void main(String[] args)
{
ActiveXComponent LODOP = new ActiveXComponent("Lodop.LodopX") ;
Dispatch lodop = LODOP.getObject();
Dispatch.call(lodop, "PRINT_INIT", "打印控件功能演示_Lodop功能_表单一");
Dispatch.call(lodop, "ADD_PRINT_TEXT", 50,231,260,39,"打印页面部分内容");
Dispatch.call(lodop, "PRINT");
System.out.println("...................lodop="+lodop);
}
}
=================================
不断更新和补充中
遇到问题,可先用xps或pdf虚拟打印机测试,排查是打印机原因还是代码原因。
该文章在 2023/9/27 11:19:57 编辑过