/// <summary> /// Sample : Creating printing receipt commands. /// </summary> public static byte[] CreateLocalizeReceiptCommands(ReceiptInformationManager receiptInfo) { // Your printer emulation. Emulation emulation = SharedInformationManager.SelectedEmulation; // print paper size int paperSize = receiptInfo.ActualPaperSize; // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs" ReceiptInformationManager.ReceiptType type = receiptInfo.Type; LocalizeReceipt localizeReceipt = receiptInfo.LocalizeReceipt; byte[] commands; switch (type) { default: case ReceiptInformationManager.ReceiptType.Text: commands = PrinterFunctions.CreateTextReceiptData(emulation, localizeReceipt, false); break; case ReceiptInformationManager.ReceiptType.TextUTF8: commands = PrinterFunctions.CreateTextReceiptData(emulation, localizeReceipt, true); break; case ReceiptInformationManager.ReceiptType.Raster: commands = PrinterFunctions.CreateRasterReceiptData(emulation, localizeReceipt); break; case ReceiptInformationManager.ReceiptType.RasterBothScale: commands = PrinterFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipt, paperSize, true); break; case ReceiptInformationManager.ReceiptType.RasterScale: commands = PrinterFunctions.CreateScaleRasterReceiptData(emulation, localizeReceipt, paperSize, false); break; case ReceiptInformationManager.ReceiptType.RasterCoupon: commands = PrinterFunctions.CreateCouponData(emulation, localizeReceipt, paperSize, BitmapConverterRotation.Normal); break; case ReceiptInformationManager.ReceiptType.RasterCouponRotation90: commands = PrinterFunctions.CreateCouponData(emulation, localizeReceipt, paperSize, BitmapConverterRotation.Right90); break; } return(commands); }
/// <summary> /// Sample : Creating printing receipt with page mode commands. /// </summary> public static byte[] CreateLocalizeReceiptWithPageModeCommands(ReceiptInformationManager receiptInfo) { // Your printer emulation. Emulation emulation = SharedInformationManager.SelectedEmulation; // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs" LocalizeReceipt localizeReceipt = receiptInfo.LocalizeReceipt; // Image height. int height = 30 * 8; // Image width. int width = SharedInformationManager.SelectedActualPaperSize; // Image rotation. BitmapConverterRotation rotation = receiptInfo.Rotation; // Print region. Rectangle printRegion; switch (rotation) { default: case BitmapConverterRotation.Normal: printRegion = new Rectangle(0, 0, width, height); break; case BitmapConverterRotation.Right90: printRegion = new Rectangle(0, 0, width, width); break; case BitmapConverterRotation.Rotate180: printRegion = new Rectangle(0, 0, width, height); rotation = BitmapConverterRotation.Rotate180; break; case BitmapConverterRotation.Left90: printRegion = new Rectangle(0, 0, height, width); break; } byte[] commands = PrinterFunctions.CreateTextPageModeData(emulation, localizeReceipt, printRegion, rotation, false); return(commands); }
/// <summary> /// Sample : Creating printing paste text with black mark commands. /// </summary> private byte[] CreatePrintBlackMarkPasteTextCommands(string pasteText) { // Your printer emulation. Emulation emulation = SharedInformationManager.SelectedEmulation; // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs" LocalizeReceipt localizeReceipt = SharedInformationManager.SelectedLocalizeReceipt; // Select using double height. bool doubleHeight = (bool)doubleHeightCheckBox.IsChecked; // Select black mark type. BlackMarkType blackMarkType = SharedInformationManager.SelectedBlackMarkType; byte[] commands = PrinterFunctions.CreatePasteTextBlackMarkData(emulation, localizeReceipt, pasteText, doubleHeight, blackMarkType, false); return(commands); }
/// <summary> /// Sample : Printing photo from image file. /// </summary> public static void PrintPhotoFromLibrary() { // Get printing file path. string filePath = ShowSelectImageFileDialog(); if (filePath == null) { return; } // Your printer emulation. Emulation emulation = SharedInformationManager.SelectedEmulation; // print paper size int paperSize = SharedInformationManager.SelectedActualPaperSize; byte[] commands = PrinterFunctions.CreateFileOpenData(emulation, filePath, paperSize); Print(commands); }
/// <summary> /// Sample : Creating printing receipt with black mark commands. /// </summary> public static byte[] CreateLocalizeReceiptWithBlackMarkCommands(ReceiptInformationManager receiptInfo) { // Your printer emulation. Emulation emulation = SharedInformationManager.GetSelectedEmulation(); // Select black mark type. BlackMarkType blackMarkType = SharedInformationManager.GetSelectedBlackMarkType(); // Creating localize receipt commands sample is in "LocalizeReceipts/'Language'Receipt.cs" ReceiptInformationManager.ReceiptType type = receiptInfo.Type; LocalizeReceipt localizeReceipt = receiptInfo.LocalizeReceipt; byte[] commands; switch (receiptInfo.Type) { default: case ReceiptInformationManager.ReceiptType.Text: commands = PrinterFunctions.CreateTextBlackMarkData(emulation, localizeReceipt, blackMarkType, false); break; } return(commands); }