0

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: Label example 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: Wrong direction print

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
Fernando
  • 128
  • 1
  • 1
  • 9
  • Use device manager on both local and remote machines and see if the same driver is installed. Did you add any custom headers to your local machine printer that may not be on other machines? – jdweng Aug 23 '22 at 12:46
  • Yes, I used the same installer on both machines. Also any Fonts that existis in my local machines exists in the remote one. And no, no custom headers are used. – Fernando Aug 23 '22 at 12:55
  • Please still check. You may be using different operating system or something else may be happening. Usually issue like this happen when the Microsoft Generic Driver is used instead of the manufactures driver. The other possibility windows updates may not be the same on the machines. Also mother board drivers may need updating. The driver is calling windows dlls and the dlls may be different. – jdweng Aug 23 '22 at 13:29
  • Sorry for the delay, been busy at work. I will update the description with some info, not sure if it will be of much help. – Fernando Aug 24 '22 at 14:44
  • I would contact printer manufacturer. There is a difference in the OS that is causing issues. Probably a Window dll. There is a header that get sent to the printer with control characters that sets up the printer. There is a difference in the windows version that is causing issues. Not sure how you are connecting to printer(serial, usb, etherrnet). If serial you could capture data by connecting a serial port in place of printer and capture data with putty. If ethernet capture with sniffer like wireshark or fiddler. One solution is to add ascii string to print driver to rotate printing. – jdweng Aug 24 '22 at 14:59
  • I will give it a try and post the result. – Fernando Aug 24 '22 at 17:02
  • No Idea why, but at least it prints on the right direction. Steps: Removed the barcode, changed, again, the driver to the manufacturer, changed the printer page configuration to match the local machine, again. Printed a sample, it worked, then Re-added the barcode. Now, I just need to fix the way it prints the label. For now, I need to print one, then jump one, so the label can be taken. – Fernando Aug 25 '22 at 13:56

0 Answers0