Click here to Skip to main content
15,791,440 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
please help me. I am new to c# POS .net printing and I am using an EPSON TM-T81 thermal printer for my project.

I already know how to print barcodes horizontally using the PosPrinter.PrintBarBarcode method but my problem is I want to print the barcode vertically.

I can print vertically any text using PosPrinter.RotatePrint method provided that i specify its PrintRotation to any of the following enums: Left90,Normal,Rigth90,Rotate180,Barcode,Bitmap

I noticed that the PrintRotaion contains both Barcode and Bitmap so I thought that I can also print barcode vertically using the PosPrinter.RotatePrint and i did this:

//the PosPrinter obj is named printer and has already been opened,claimed and enabled
printer.RotatePrint(PrinterStation.Receipt, PrintRotation.Barcode);
//stop rotation and back to normal printing
printer.RotatePrint(PrinterStation.Receipt, PrintRotation.Normal);

This code will perfectly compile but when i start to execute the code, an
exception will be handled as I have used try-catch in this block

This is the Exception:

Method RotatePrint threw an exception. Attempt was made to perform an illegal or unsupported operation with the device, or an invalid parameter value was used.

I read the PrintRotation.Barcode description and it says:

Rotate barcode printing. (ORed with one of the above rotation values.)

Now, what does the "(ORed with one of the above rotation values.)" mean? Do I have to specify another PrintRotation enum before my block of code like this?

the PosPrinter obj is named printer and has already been opened,claimed and enabled
//I added this
printer.RotatePrint(PrinterStation.Receipt, PrintRotation.Left90);

printer.RotatePrint(PrinterStation.Receipt, PrintRotation.Barcode);
printer.PrintBarCode(PrinterStation.Receipt, "123", BarCodeSymbology.Code128, printer.RecLineHeight,printer.RecLineWidth,PosPrinter.PrinterBarCodeCenter,BarCodeTextPosition.Below);
printer.RotatePrint(PrinterStation.Receipt, PrintRotation.Normal);

When i try to execute these statements i still get the same exception.

Please help me. Can barcode be printed vertically? Is this is not the way to print the barcode
vertically? Thank you so much guys.

[Modified] Code Format [Modified]
Updated 4-Dec-14 20:26pm
krishnala 20-Nov-15 11:38am    
I am looking to print Barcode in wpf POS Project ?

1 solution

Check available rotation before attempting to rotate since it may not be supported.

var rotationList = m_Printer.RecBarCodeRotationList;
Share this answer
Richard MacCutchan 5-Feb-18 11:24am    
THREE years too late.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900