I use this device to print a barcode but printer doesn't stop printing, giving me empty tags until I shut it down. I found this question but specifying the Paper Size didn't help me.
The code I use:
PrintDocument document = new PrintDocument();
document.DefaultPageSettings.PaperSize =
new PaperSize("Custom", Centimeters(7), Centimeters(5));
document.PrintPage += (s, a) =>
{
a.Graphics.DrawString("*123456*",
BarcodeFont,
new SolidBrush(Color.Black),
new Point(0, 0));
}
document.Print();
Centimeters Method:
// Converts the unit "Hundredths of an inch" to centimeter.
int Centimeters(int centimeters)
{
return (int)((centimeters * 100) / 2.54);
}
It prints the barcode to first tag correctly but it doesn't stop. Tags are 7x5 cm. and I set the paper size according to this, I have no idea what else I can do.
Edit: Setting HasMorePages to false didn't help and I know it's not because of the device I use: There are some other programs I currently use to print barcodes and they all work.
Set the HasMorePages
property of the eventArgs
to false:
document.PrintPage += (s, a) =>
{
a.Graphics.DrawString("*123456*",
BarcodeFont,
new SolidBrush(Color.Black),
new Point(0, 0));
a.HasMorePages = false;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With