I have a printer model Argox OS-214 plus series PPLA and I am having trouble with some unexpected behavior while using a C# application.
After the initial configuration I am able to print a text plus a barcode on my local computer that implements the following pattern:
While it is used on my local computer it works wonders. However, when I install the program at the remote desktop, the printer starts to print the label on the wrong direction and cuts off that falls outside the range, example:
I have already installed and reinstalled the same drivers at the remote desktop to no avail, since it is a remote application I use an Universal Printer(Name only) on the remote desktop so it will, or should, behave as medium to the physical printer.
What I coded:
private StringToEAN13 ean13 = null;
public void ButtonPrintLabel(string code)
{
try
{
ean13 = new CreateEAN13(code);
PrinterSettings ps = new PrinterSettings();
PrintDocument printDoc = new PrintDocument();
printDoc.PrinterSettings = ps;
printDoc.DefaultPageSettings.Landscape = false; // Latest attempt
printDoc.DefaultPageSettings.PaperSize = new PaperSize("Custom", 270, 100);
printDoc.BeginPrint += new PrintEventHandler(BeginLabel);
printDoc.PrintPage += new PrintPageEventHandler(PrintLabel);
printDoc.Print();
}
catch (Exception ex)
{
MessageBox.Show($"Error: { ex.Message }", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void BeginLabel(object sender, PrintEventArgs e)
{
_lista = new List<string>();
_lista.Clear();
_lista.Add("Text Example");
_lista.Add("Text Details");
}
_lista.Add(ean13.Codigo); //BARCODE
}
private void PrintLabel(object sender, PrintPageEventArgs e)
{
e.Graphics.PageUnit = GraphicsUnit.Millimeter;
FontFamily fontFamily = new FontFamily("C39HrP24DhTt", collection);
Font fontBARCODE = new Font(fontFamily, 30);
Font fontePrint = new Font("Arial", 9);
Font fontePrintBold = new Font("Arial", 9, FontStyle.Bold);
SolidBrush Pencil = new SolidBrush(Color.Black);
float xpos = 3, ypos = 3;
int texto = _lista[0].Length > 30 ? 30 : _lista[0].Length;
e.Graphics.DrawString(_lista[0].Substring(0, texto), fontePrint, Pencil, xpos, (float)(0.5 * ypos));
e.Graphics.DrawString(_lista[1], fontePrintBold, Pencil, xpos, (float)(1.5 * ypos));
string data = _lista[2];
string barcodeData = "*" + data + "*";
e.Graphics.DrawString(barcodeData, fontBARCODE, new SolidBrush(Color.Black), xpos, (float)(2.7 * ypos));
}
What I have tried:
- Change the Orientation to Landscape on the local printer(Before the Latest attempt);
- Change the Orientation to Landscape on Universal Printer(Again, before the Latest attempt);
- Install/Reinstall the Argox drivers on Remote Desktop;
- Replicate the settings on the local machine to the remote one;
- Install and replicate the settings in another local machine. The result was the same on both local machines;
I have no more ideas of what to do. Unfortunally, I have no spare printer, so replacing it is not an option.
** UPDATE 24/08/2022 **
Remote Desktop:
- Windows Server 2016 Datacenter x64
- Version: 1607
- Build: 14393.5291
- Printer driver: Argox OS-214 plus series PPLA
Local Desktop:
- Windows 10 x64
- Version: 21H1
- Build: 19043.1889
- Printer driver: Argox OS-214 plus series PPLA