Search code examples
c#asp.netthermal-printeroposposiflex

OPOS Printing using ASP.NET


I have developed a Restaurant Billing Web App (Not Desktop application as the requirement was a web-app to be run in browser) Using ASP.NET Web Forms C# 4.0. Now the new Requirement is POS thermal Printer receipt printing. I am very new to POS, but somehow I managed to build and run a Sample Windows Form Application to print on POSIFLEX PP6800 Thermal Receipt Printer using c#.

The Problem is that I am unable to print using the same Code on the Localhost website. I am using OPOS CCO, OposForDotNetAssemblies-1_13_000.

My Questions are:

  1. Is it possible to print on OPOS on LocalHost ?
  2. Is it possible to Print on OPOS over Internet Website ?
  3. If Yes then what should I do? What am I doing wrong?

The Code I am Using is:

using POS.Devices;
private OPOSPOSPrinter Printer = null;
protected void Button1_Click(object sender, EventArgs e)
{
    Printer = new OPOSPOSPrinterClass();

    // Open the printer.
    Printer.Open("PosPrinter");
    Printer.ClaimDevice(1000);
    Printer.AsyncMode = true;
    Printer.DeviceEnabled = true;
    Printer.ResultCode;
    Printer.PrintNormal(2, "\x1B|cA\x1B|2CHeading\x1B|1C\n"+DateTime.Now.ToString("D")+"\n\n" );
    Printer.CutPaper(1);
    Printer.Close();
 }

Interestingly there is no Error, but I hear Beeps till the timeout and then printer prints some dots and characters in one line and nothing else. Which is not happening in the windows form. Thanks in advance.


Solution

  • i recently developed a POS Web Application which uses thermal printer to print Receipts , it uses a local printer

    you simply use javascript to capture the container or .....your content

    and simply call it using window.print() nto print your receipt it works for me