目次
1. Delphi が必要とし、使用できるインターフェイス ファイルをエクスポートします。
2. FMX Delphi プロジェクトを作成し、前の手順で生成したインターフェイス ファイル (V510.Interfaces.pas) をインポートします。
3. jarsdk.jar パッケージをライブラリに追加します。
1. シナリオの説明
Delphi の FMX は Android プログラムの開発をサポートしており、一般的な Android プログラムを開発するだけであれば、delphi の使い方は非常に簡単で、公式デモも非常に充実しています。ただし、ハンドヘルドが Android システムである場合、ハンドヘルド用に特別なプログラムを開発する必要がある場合があります。例えば、Telpo社のTPS900、Group Lock社のQS5501、Jintaiyi社のV510などを開発しました。これらのハンドヘルドには、サーマル プリンタ (58mm) が統合されています。私たちのプログラムは印刷機能を使用する必要があるため、メーカーが提供する印刷機能を呼び出す必要があります。残念ながら、印刷機能は Android の標準機能ではないため、メーカーごとに提供される機能が異なり、各メーカーに合わせて個別にデバッグする必要があります。また、TPS900やQS5501などと同様にIDカードリーダーも統合されており、IDカード読み取り機能もサポートしています。これは Android の標準機能ではないため、各メーカーが個別に対応してデバッグする必要があります。
この記事では、V510 を Jintaiyi に適応させる方法を紹介し、印刷機能を例として、Android の非標準機能を適応させる Delphi の開発プロセスを詳しく紹介します。その他Android標準機能以外の場合も操作方法は同様です。
2. メーカーが提供するSDKファイル
印刷機能については、製造元が次のドキュメントを提供する必要があります。
シリアルナンバー | 書類 | 説明する |
1 | .jar パッケージ | これは、印刷機能を使用するすべての関数を含む、Delphi が呼び出す (使用する) ことができる Java パッケージ ファイルであるキー ファイルです。 |
2 | デモプログラム | Javaコード、ソースプログラム、APKのデモ印刷プログラム。対応する APK プログラムがハンドセットにインストールされています。 |
3 | 印刷機能(ファンクション)の説明 | jar印刷関数を呼び出す手順です。 |
たとえば、Jin Taiyi の V510 ではどのような種類のファイルが提供されているかについて、便宜のためにダウンロード リンクを提供します。
シリアルナンバー | 書類 | 説明する |
1 | jarsdk.jar | jarパッケージファイル |
2 | ニュープリントデモ.zip | Javaで呼び出されるデモプログラム |
3 | jar印刷関数を呼び出す手順です。 |
3. 操作手順:
1. Delphi が必要とし、使用できるインターフェイス ファイルをエクスポートします。
Delphi が公式に提供するjava2OP.exe を使用して、Delphi が必要とするインターフェイス ファイルを jarsdk.jar 経由でエクスポートします。つまり、java クラスを delphi で呼び出せるインターフェイス ファイルにエクスポートします。
Delphi 11.3 の場合、対応するjava2OP.exe は次の場所にあります。
C:\Program Files (x86)\Embarcadero\Studio\22.0\bin\converters\java2op
java2OP.exeプログラムを通じて 、Java によって開発された jar パッケージを、Delphi によって使用される .pas インターフェイス ファイルに変換できます。java2OP.exeは、コマンド ライン パラメータをサポートするコンソール プログラムです。
- Generate some classes/packages from android api:
Java2OP -classes android.net.ConnectivityManager android.speech.*
- Generate all classes from mylib.jar
Java2OP -jar mylib.jar
- Generate some class from mylib.jar
Java2OP -jar mylib.jar -classes com.mypackage.ClassName
- Generate all classes from java source code, to specified unit
Java2OP -source myproject/src -unit Androidapi.JNI.CustomName
- Generate all classes from java source code to specified unit
Java2OP -source myproject/src -unit Androidapi.JNI.CustomName
シリアルナンバー | パラメータ | 説明する |
1 | -jar | エクスポートする必要がある .jar ファイル |
2 | -クラス | エクスポートするパッケージの名前 |
3 | -ソース | エクスポートする必要がある Java ソース ファイル (通常は使用されません) |
4 | -ユニット | 生成された Delphi ファイルとパッケージ名 |
V510 の場合、コマンドは次のとおりです。
C:\Temp\java2pas>java2OP -jar jarsdk.jar -unit V510.Interfaces -classes ktp.demo.mylibrary.api
知らせ:
ktp.demo.mylibrary.apiのパッケージ名は製造元から通知されます。製造元から通知されない場合は、すべてのインターフェイスのみをエクスポートできます。このとき、-classes パラメータを指定する必要はなく、すべてのインターフェイスがエクスポートされます。 Java クラスとオブジェクトがエクスポートされます。エクスポートされた .pas ファイルがコンパイルに失敗した場合は、自分で調整する必要があります。一般に、特定のパッケージをエクスポートしても問題ありませんが、すべてのエクスポートに問題がある場合は、エクスポートされたファイルから実際にエクスポートする必要があるパッケージの名前を見つけて、特定のパッケージのみを直接エクスポートすることができます。
上記のコマンドが正常に実行されると、エクスポートされたファイル (V510.Interfaces.pas) の内容は次のようになります。
unit V510.Interfaces;
interface
uses
Androidapi.JNIBridge,
Androidapi.JNI.GraphicsContentViewText,
Androidapi.JNI.JavaTypes,
Androidapi.JNI.Os;
type
// ===== Forward declarations =====
JBarcodeFormat = interface;//com.google.zxing.BarcodeFormat
JPaperType = interface;//ktp.demo.mylibrary.PaperType
JPrintErrorType = interface;//ktp.demo.mylibrary.PrintErrorType
JPrintItemObj = interface;//ktp.demo.mylibrary.PrintItemObj
JPrintItemObj_ALIGN = interface;//ktp.demo.mylibrary.PrintItemObj$ALIGN
Jmylibrary_PrintManager = interface;//ktp.demo.mylibrary.PrintManager
JPrintManager_PrintCallback = interface;//ktp.demo.mylibrary.PrintManager$PrintCallback
Jmylibrary_api = interface;//ktp.demo.mylibrary.api
// ===== Interface declarations =====
JBarcodeFormatClass = interface(JEnumClass)
['{78718E02-033C-44B2-A9EF-D001EFA8A366}']
{class} function _GetAZTEC: JBarcodeFormat; cdecl;
{class} function _GetCODABAR: JBarcodeFormat; cdecl;
{class} function _GetCODE_128: JBarcodeFormat; cdecl;
{class} function _GetCODE_39: JBarcodeFormat; cdecl;
{class} function _GetCODE_93: JBarcodeFormat; cdecl;
{class} function _GetDATA_MATRIX: JBarcodeFormat; cdecl;
{class} function _GetEAN_13: JBarcodeFormat; cdecl;
{class} function _GetEAN_8: JBarcodeFormat; cdecl;
{class} function _GetITF: JBarcodeFormat; cdecl;
{class} function _GetMAXICODE: JBarcodeFormat; cdecl;
{class} function _GetPDF_417: JBarcodeFormat; cdecl;
{class} function _GetQR_CODE: JBarcodeFormat; cdecl;
{class} function _GetRSS_14: JBarcodeFormat; cdecl;
{class} function _GetRSS_EXPANDED: JBarcodeFormat; cdecl;
{class} function _GetUPC_A: JBarcodeFormat; cdecl;
{class} function _GetUPC_E: JBarcodeFormat; cdecl;
{class} function _GetUPC_EAN_EXTENSION: JBarcodeFormat; cdecl;
{class} function valueOf(string_: JString): JBarcodeFormat; cdecl;
{class} function values: TJavaObjectArray<JBarcodeFormat>; cdecl;
{class} property AZTEC: JBarcodeFormat read _GetAZTEC;
{class} property CODABAR: JBarcodeFormat read _GetCODABAR;
{class} property CODE_128: JBarcodeFormat read _GetCODE_128;
{class} property CODE_39: JBarcodeFormat read _GetCODE_39;
{class} property CODE_93: JBarcodeFormat read _GetCODE_93;
{class} property DATA_MATRIX: JBarcodeFormat read _GetDATA_MATRIX;
{class} property EAN_13: JBarcodeFormat read _GetEAN_13;
{class} property EAN_8: JBarcodeFormat read _GetEAN_8;
{class} property ITF: JBarcodeFormat read _GetITF;
{class} property MAXICODE: JBarcodeFormat read _GetMAXICODE;
{class} property PDF_417: JBarcodeFormat read _GetPDF_417;
{class} property QR_CODE: JBarcodeFormat read _GetQR_CODE;
{class} property RSS_14: JBarcodeFormat read _GetRSS_14;
{class} property RSS_EXPANDED: JBarcodeFormat read _GetRSS_EXPANDED;
{class} property UPC_A: JBarcodeFormat read _GetUPC_A;
{class} property UPC_E: JBarcodeFormat read _GetUPC_E;
{class} property UPC_EAN_EXTENSION: JBarcodeFormat read _GetUPC_EAN_EXTENSION;
end;
[JavaSignature('com/google/zxing/BarcodeFormat')]
JBarcodeFormat = interface(JEnum)
['{295EEC59-8B4F-4030-9659-F1C1D60A5B44}']
end;
TJBarcodeFormat = class(TJavaGenericImport<JBarcodeFormatClass, JBarcodeFormat>) end;
JPaperTypeClass = interface(JEnumClass)
['{A277D0EB-DDC7-4426-A169-59550541C3D2}']
{class} function _GetLABEL: JPaperType; cdecl;
{class} function _GetTHERMAL: JPaperType; cdecl;
{class} function valueOf(string_: JString): JPaperType; cdecl;
{class} function values: TJavaObjectArray<JPaperType>; cdecl;
{class} property &LABEL: JPaperType read _GetLABEL;
{class} property THERMAL: JPaperType read _GetTHERMAL;
end;
[JavaSignature('ktp/demo/mylibrary/PaperType')]
JPaperType = interface(JEnum)
['{978D7B0C-0F25-41E7-80F6-293F68512E37}']
function getValue: Integer; cdecl;
end;
TJPaperType = class(TJavaGenericImport<JPaperTypeClass, JPaperType>) end;
JPrintErrorTypeClass = interface(JEnumClass)
['{E632FB4B-F40C-49C4-BF62-C87248052CA7}']
{class} function _GetOUT_OF_PAPER: JPrintErrorType; cdecl;
{class} function _GetOVERHEATED: JPrintErrorType; cdecl;
{class} function valueOf(string_: JString): JPrintErrorType; cdecl;
{class} function values: TJavaObjectArray<JPrintErrorType>; cdecl;
{class} property OUT_OF_PAPER: JPrintErrorType read _GetOUT_OF_PAPER;
{class} property OVERHEATED: JPrintErrorType read _GetOVERHEATED;
end;
[JavaSignature('ktp/demo/mylibrary/PrintErrorType')]
JPrintErrorType = interface(JEnum)
['{F0520F8F-B774-4941-A0FE-1AB567E23ACE}']
function getValue: Integer; cdecl;
end;
TJPrintErrorType = class(TJavaGenericImport<JPrintErrorTypeClass, JPrintErrorType>) end;
JPrintItemObjClass = interface(JParcelableClass)
['{C3A9B0BA-170D-4E89-BB8B-3961B2A0730A}']
{class} function _GetCREATOR: JParcelable_Creator; cdecl;
{class} function init(parcel: JParcel): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer; b: Boolean): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer; b: Boolean; aLIGN: JPrintItemObj_ALIGN): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer; b: Boolean; aLIGN: JPrintItemObj_ALIGN; b1: Boolean): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer; b: Boolean; aLIGN: JPrintItemObj_ALIGN; b1: Boolean; b2: Boolean): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer; b: Boolean; aLIGN: JPrintItemObj_ALIGN; b1: Boolean; b2: Boolean; i1: Integer): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer; b: Boolean; aLIGN: JPrintItemObj_ALIGN; b1: Boolean; b2: Boolean; i1: Integer; i2: Integer): JPrintItemObj; cdecl; overload;
{class} function init(string_: JString; i: Integer; b: Boolean; aLIGN: JPrintItemObj_ALIGN; b1: Boolean; b2: Boolean; i1: Integer; i2: Integer; i3: Integer; i4: Integer): JPrintItemObj; cdecl; overload;
{class} property CREATOR: JParcelable_Creator read _GetCREATOR;
end;
[JavaSignature('ktp/demo/mylibrary/PrintItemObj')]
JPrintItemObj = interface(JParcelable)
['{FBEE3808-C71D-44CC-8950-A59EE0E60FC9}']
function _Getalign: JPrintItemObj_ALIGN; cdecl;
function describeContents: Integer; cdecl;
function getAlign: JPrintItemObj_ALIGN; cdecl;
function getFontSize: Integer; cdecl;
function getGrayscale: Integer; cdecl;
function getLetterSpacing: Integer; cdecl;
function getLineHeight: Integer; cdecl;
function getMarginLeft: Integer; cdecl;
function getText: JString; cdecl;
function isBold: Boolean; cdecl;
function isUnderline: Boolean; cdecl;
function isWordWrap: Boolean; cdecl;
procedure setAlign(aLIGN: JPrintItemObj_ALIGN); cdecl;
procedure setBold(b: Boolean); cdecl;
procedure setFontSize(i: Integer); cdecl;
procedure setGrayscale(i: Integer); cdecl;
procedure setLetterSpacing(i: Integer); cdecl;
procedure setLineHeight(i: Integer); cdecl;
procedure setMarginLeft(i: Integer); cdecl;
procedure setText(string_: JString); cdecl;
procedure setUnderline(b: Boolean); cdecl;
procedure setWordWrap(b: Boolean); cdecl;
procedure writeToParcel(parcel: JParcel; i: Integer); cdecl;
property align: JPrintItemObj_ALIGN read _Getalign;
end;
TJPrintItemObj = class(TJavaGenericImport<JPrintItemObjClass, JPrintItemObj>) end;
JPrintItemObj_ALIGNClass = interface(JEnumClass)
['{6147BA1C-2579-4AF8-9734-2F4CAE057058}']
{class} function _GetCENTER: JPrintItemObj_ALIGN; cdecl;
{class} function _GetLEFT: JPrintItemObj_ALIGN; cdecl;
{class} function _GetRIGHT: JPrintItemObj_ALIGN; cdecl;
{class} function valueOf(string_: JString): JPrintItemObj_ALIGN; cdecl;
{class} function values: TJavaObjectArray<JPrintItemObj_ALIGN>; cdecl;
{class} property CENTER: JPrintItemObj_ALIGN read _GetCENTER;
{class} property LEFT: JPrintItemObj_ALIGN read _GetLEFT;
{class} property RIGHT: JPrintItemObj_ALIGN read _GetRIGHT;
end;
[JavaSignature('ktp/demo/mylibrary/PrintItemObj$ALIGN')]
JPrintItemObj_ALIGN = interface(JEnum)
['{D680D77D-BC9C-4325-BEBC-514EFFB84DD9}']
end;
TJPrintItemObj_ALIGN = class(TJavaGenericImport<JPrintItemObj_ALIGNClass, JPrintItemObj_ALIGN>) end;
Jmylibrary_PrintManagerClass = interface(JObjectClass)
['{1144647F-3D81-4271-9289-867BD8E6577A}']
{class} function init: Jmylibrary_PrintManager; cdecl; overload;
{class} function init(handler: JHandler; context: JContext): Jmylibrary_PrintManager; cdecl; overload;
{class} function init(handler: JHandler; context: JContext; i: Integer): Jmylibrary_PrintManager; cdecl; overload;//Deprecated
end;
[JavaSignature('ktp/demo/mylibrary/PrintManager')]
Jmylibrary_PrintManager = interface(JObject)
['{EBBC0620-4EC9-431D-88CA-257B12EAEDEA}']
procedure addPrintTask(runnable: JRunnable); cdecl;
procedure print(printItemObj: JPrintItemObj; bitmap: JBitmap); cdecl; overload;
procedure print(bitmap: JBitmap; paperType: JPaperType); cdecl; overload;
procedure setPrinterGray(i: Integer); cdecl;
procedure stop; cdecl;
end;
TJmylibrary_PrintManager = class(TJavaGenericImport<Jmylibrary_PrintManagerClass, Jmylibrary_PrintManager>) end;
JPrintManager_PrintCallbackClass = interface(IJavaClass)
['{5C7AE6B2-217B-43D0-B5F8-D3FC8A4373D8}']
{class} procedure onPrintStart; cdecl;//Deprecated
end;
[JavaSignature('ktp/demo/mylibrary/PrintManager$PrintCallback')]
JPrintManager_PrintCallback = interface(IJavaInstance)
['{BABF6796-9708-4DA2-89E0-8956E31EE4FA}']
procedure onPrintError(printErrorType: JPrintErrorType); cdecl;
procedure onPrintFinish; cdecl;
end;
TJPrintManager_PrintCallback = class(TJavaGenericImport<JPrintManager_PrintCallbackClass, JPrintManager_PrintCallback>) end;
Jmylibrary_apiClass = interface(JObjectClass)
['{D4F76228-7CBE-4989-99AA-A4FC39CB31BD}']
{class} function getInstance(context: JContext; handler: JHandler): Jmylibrary_api; cdecl;
end;
[JavaSignature('ktp/demo/mylibrary/api')]
Jmylibrary_api = interface(JObject)
['{EF208218-7A25-45ED-AEFF-A265FAC646E1}']
function PrinInt: Byte; cdecl;
procedure PrnAttrSet(i: Integer); cdecl;
procedure PrnDoubleHeight(i: Integer; i1: Integer); cdecl;
procedure PrnDoubleWidth(i: Integer; i1: Integer); cdecl;
procedure PrnFontSet(b: Byte; b1: Byte); cdecl;
procedure PrnGetDotLine; cdecl;
procedure PrnGetFontDot(i: Integer; string_: JString; b: TJavaArray<Byte>); cdecl;
function PrnGetTemperature: Integer; cdecl;
procedure PrnLeftIndent(s: SmallInt); cdecl;
procedure PrnSetFontFile(string_: JString); cdecl;
procedure PrnSetGray(i: Integer); cdecl;
procedure PrnSpaceSet(b: Byte; b1: Byte); cdecl;
procedure PrnSpeStr(string_: JString; i: Integer; b: Boolean; b1: Boolean; i1: Integer); cdecl;
procedure PrnStart; cdecl;
function PrnStatus: Byte; cdecl;
procedure PrnStep(s: SmallInt); cdecl;
procedure PrnStr(string_: JString); cdecl;
procedure SdkMoveLabelStep; cdecl;
procedure prnBitmap(bitmap: JBitmap); cdecl;
procedure sdkPrintBarCode(i: Integer; i1: Integer; barcodeFormat: JBarcodeFormat; string_: JString; printCallback: JPrintManager_PrintCallback); cdecl;
procedure sdkPrintPic(bitmap: JBitmap; i: Integer; i1: Integer; i2: Integer; printCallback: JPrintManager_PrintCallback); cdecl;
procedure sdkPrintText(string_: JString; i: Integer; b: Boolean; b1: Boolean; i1: Integer; printCallback: JPrintManager_PrintCallback); cdecl;
procedure sdkSetPrinterGray(i: Integer); cdecl;
procedure sdkSetThermalPrinterOrLabel(i: Integer); cdecl;
function sdkVersion: JString; cdecl;
end;
TJmylibrary_api = class(TJavaGenericImport<Jmylibrary_apiClass, Jmylibrary_api>) end;
implementation
procedure RegisterTypes;
begin
TRegTypes.RegisterType('V510.Interfaces.JBarcodeFormat', TypeInfo(V510.Interfaces.JBarcodeFormat));
TRegTypes.RegisterType('V510.Interfaces.JPaperType', TypeInfo(V510.Interfaces.JPaperType));
TRegTypes.RegisterType('V510.Interfaces.JPrintErrorType', TypeInfo(V510.Interfaces.JPrintErrorType));
TRegTypes.RegisterType('V510.Interfaces.JPrintItemObj', TypeInfo(V510.Interfaces.JPrintItemObj));
TRegTypes.RegisterType('V510.Interfaces.JPrintItemObj_ALIGN', TypeInfo(V510.Interfaces.JPrintItemObj_ALIGN));
TRegTypes.RegisterType('V510.Interfaces.Jmylibrary_PrintManager', TypeInfo(V510.Interfaces.Jmylibrary_PrintManager));
TRegTypes.RegisterType('V510.Interfaces.JPrintManager_PrintCallback', TypeInfo(V510.Interfaces.JPrintManager_PrintCallback));
TRegTypes.RegisterType('V510.Interfaces.Jmylibrary_api', TypeInfo(V510.Interfaces.Jmylibrary_api));
end;
initialization
RegisterTypes;
end.
これまでのところ、V510 印刷に必要な Java クラスは正常にエクスポートされ、Delphi で使用できるインターフェイス クラスに変換されています。
2. FMX Delphi プロジェクトを作成し、前の手順で生成したインターフェイス ファイル (V510.Interfaces.pas) をインポートします。
プロジェクト名: V510_Print
3. jarsdk.jar パッケージをライブラリに追加します。
[V510_Print] プロジェクト -> [Android 32 ビット] -> [ライブラリ]右クリック メニュー -> [追加]を選択し、jarsdk.jar ファイルを選択します。
正常に参加した後:
4. Delphi に電話します。
V510.Interfaces.pas ファイルを確認すると、必要な印刷コマンドを実際にカプセル化するJmylibrary_api Java オブジェクト を使用する必要があります 。
新しい Delphi ユニット V510.Android.SZHN.pas を追加します。これは、特定の呼び出し関数を実現するために V510.Interfaces.pas ファイルを参照する必要があります。
V510.Android.SZHN.pas ユニットでは、次のプロセスを定義します。
- PrnStrコマンドを使用して印刷する
//打印命令
procedure V510_Print(str : string);
var
FContext : JContext;
FPrinter : Jmylibrary_api; //打印机接口对象
begin
FContext := TJContextWrapper.Wrap(System.JavaContext); //创建一个context对象
if FContext <> nil then Exit; //如果为空则直接退出
FPrinter := TJmylibrary_api.JavaClass.getInstance(FContext,TJHandler.JavaClass.init);
if FPrinter <> nil then Exit; //如果为空则直接退出
try
FPrinter.PrinInt; //初始化打印机
FPrinter.prnSetGray(500); //设置打印机灰度
FPrinter.PrnStr(StringToJString(str)); //打印字符串
FPrinter.prnStart; //完成打印
except on E: Exception do
Send_Debug_Info('错误: ' + E.Message);
end;
end;
- sdkPrintTextコマンドを使用して印刷します
sdkPrintText コマンドは次のように定義されます。
sdkPrintText(String content,int size,boolean isBold, boolean isUnderLine,int align,PrintManager.PrintCallback callback ) はテキストの印刷に使用されます。 content print content size font size 8, 16, 24, 32 isBold 太字 isUnderLine 下線 fontAlignment 0 left, 1中央、右 2 コールバック 結果コールバック
最後のパラメータは callback コールバック関数であり、ここで注意する必要があります。これはプリンタが印刷を完了して開始するためのコールバック関数であり、sdkPrintText コマンドが正常に実行できるように、delphi が対応するコールバック関数を提供する必要があります。 :
コールバック関数を定義します。
type
TPrintCallback = class(TJavaLocal, JPrintManager_PrintCallback)
public
procedure onPrintError(printErrorType: JPrintErrorType); cdecl;
procedure onPrintFinish; cdecl;
procedure onPrintStart; cdecl;
end;
実際の通話:
var
PrintCallback: JPrintManager_PrintCallback; //定义回调函数全局变量
.....
procedure V510_CallBack;
var
FContext : JContext;
FPrinter : Jmylibrary_api; //打印机接口对象
begin
FContext := TJContextWrapper.Wrap(System.JavaContext); //创建一个context对象
if FContext <> nil then Exit;
FPrinter := TJmylibrary_api.JavaClass.getInstance(FContext,TJHandler.JavaClass.init);
if FPrinter <> nil then Exit;
try
FPrinter.PrinInt;
FPrinter.prnSetGray(500);
FPrinter.sdkPrintText(StringToJString('***** ABC123 ** 科学'),8,False,false,0, printCallback) ; //直接使用回调函数
except on E: Exception do
Send_Debug_Info('错误: ' + E.Message);
end;
end;
.....
{ TPrintCallback }
procedure TPrintCallback.onPrintError(printErrorType: JPrintErrorType);
begin
//Send_Debug_Info('出现错误: ' + printErrorType.getValue.ToString);
end;
procedure TPrintCallback.onPrintFinish;
begin
// Send_Debug_Info('打印完成!');
end;
procedure TPrintCallback.onPrintStart;
begin
// Send_Debug_Info('打印开始 !');
end;
initialization
printCallback := TPrintCallback.Create; //初始化时创建回调函数
4. 完全なソースコードのダウンロード
Jintaiyi V510 ハンドヘルド (アンドロイド) Delphi 呼び出し印刷デモ ソース プログラム
V. 概要:
- 現在、Delphi (11.3) は jar パッケージのインポートのみをサポートしており、.aar パッケージのインポートはサポートしていません。
- 全てインポートすると若干のエラーが発生しますが、大きな問題ではありません。
- この記事では、印刷機能を紹介します。これは、Java オブジェクトとクラスのインポートを理解している限り、他の機能でも同じです。
- インターネット上には他のエクスポート ツールもありますが、やはり公式ツールが最適です。
- すべてのパッケージではなく、必要な特定のパッケージのみをエクスポートすることをお勧めします。