=================================
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, "一個(gè)文本項(xiàng)");
PRLodop.SET_PRINT_STYLEA(0, "FontSize", 13.5);
PRLodop.SET_PRINT_STYLEA(0, "Bold", 1);
PRLodop.PREVIEW();
}
=================================
JAVA:
/**
* Java調(diào)用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,"打印頁面部分內(nèi)容");
Dispatch.call(lodop, "PRINT");
System.out.println("...................lodop="+lodop);
}
}
=================================
不斷更新和補(bǔ)充中
遇到問題,可先用xps或pdf虛擬打印機(jī)測試,排查是打印機(jī)原因還是代碼原因。
該文章在 2023/9/27 11:19:57 編輯過