|
-
-
EPSON OPOS ADK for .NET でバーコードを印字するには PosPrinter クラスの PrintBarCode メソッドを使用します。
※他のドライバー・バージョンのFAQ一覧はこちら
PrintBarCode メソッドのパラメーター ( 印刷先のステーション、バーコードの値、コード体系 ( JAN13 / CODE128 など ) 、バーコードの高さ、バーコードの幅、印字位置、 HRI 文字の位置 ) を指定することで、印字されるバーコードが決まります。
印字先のプリンターの用紙幅、印字密度によって印字領域には最大値があります。
PrintBarCode メソッドで指定されたコード体系やバーコードの高さと幅によっては、印字領域の最大値を超えてしまい、バーコードは印刷されません。
バーコードが印刷されないときは「バーコードの値を減らす」「バーコードの高さと幅を調整する」「回転印字する」などによって、印字領域内に含まれるように調整してください。
PrintBarCode メソッドのコード例
Visual Studio C#
//論理デバイス名、バーコードの値
string strLogicalName = "PosPrinter";
string strbcData = "4902720005074";
//初期処理
PosPrinter m_Printer = null;
PosExplorer posExplorer = new PosExplorer();
DeviceInfo deviceInfo = null;
deviceInfo = posExplorer.GetDevice(DeviceType.PosPrinter, strLogicalName);
m_Printer = (PosPrinter)posExplorer.CreateInstance(deviceInfo);
m_Printer.Open();
m_Printer.Claim(1000);
m_Printer.DeviceEnabled = true;
m_Printer.RecLetterQuality = true;
//バーコード印字指示
m_Printer.PrintBarCode(PrinterStation.Receipt, strbcData,
BarCodeSymbology.EanJan13, 50,
m_Printer.RecLineWidth / 2, PosPrinter.PrinterBarCodeCenter,
BarCodeTextPosition.Below);
//終了処理
m_Printer.DeviceEnabled = false;
m_Printer.Release();
m_Printer.Close();
|
RotatePrint メソッド、または RotateSpecial プロパティを使用することでバーコードの回転印字ができます。
RotateSpecial プロパティのコード例
Visual Studio C#
// ~初期処理 省略~
//右90度回転して印字するよう指示
m_Printer.RotateSpecial = Rotation.Right90;
//バーコード印字指示
m_Printer.PrintBarCode(PrinterStation.Receipt, strbcData,
BarCodeSymbology.EanJan13, 50,
m_Printer.RecLineWidth / 2, PosPrinter.PrinterBarCodeCenter,
BarCodeTextPosition.Below);
//回転印字から元に戻す
m_Printer.RotateSpecial = Rotation.Normal;
// ~終了処理 省略~
|
RotatePrint メソッドのコード例
Visual Studio C#
// ~初期処理 省略~
//左90度回転して印字するよう指示
m_Printer.RotatePrint(PrinterStation.Receipt,
PrintRotation.Left90 | PrintRotation.Barcode);
//バーコード印字指示
m_Printer.PrintBarCode(PrinterStation.Receipt, strbcData,
BarCodeSymbology.EanJan13, 50,
m_Printer.RecLineWidth / 2, PosPrinter.PrinterBarCodeCenter,
BarCodeTextPosition.Below);
//回転印字から元に戻す
m_Printer.RotatePrint(PrinterStation.Receipt, PrintRotation.Normal);
// ~終了処理 省略~
|
詳細は、プリンタードライバーに付属しているマニュアルおよびサンプルプログラムを参照してください。
モバイルプリンター |
TM-P20,TM-P60II |
PC一体型プリンター |
TM-T70II-DT,TM-T88V-DT |
TMシリーズ |
TM-H5000II,TM-H6000II,TM-H6000III,TM-H6000IV,TM-L90 オートカッターモデル,TM-L90 ピーラーモデル,TM-T20,TM-T20II,TM-T70,TM-T70II,TM-T88III,TM-T88IV,TM-T88V,TM-T90,TM-T90II,TM-U220A,TM-U220B,TM-U220D,TM-U590,TM-U675,TM-U950 |
|