Click here to Skip to main content
15,885,159 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello, I am in development of a POS Application for a Garments Showroom. The design part is done and Everything works fine. Now I need to print. I have to print to a money receipt with a POS Printer connected to the computer running the software and I wanted to print the Items shown in the DataGridView Table in a format like I have attached in the simulated Image file.

DataGridView Table Screenshot: http://img237.imagevenue.com/img.php?image=51739_Slip01_122_174lo.jpg[^]

A Simulated Image Receipt: http://img247.imagevenue.com/img.php?image=51740_Slip02_122_105lo.jpg[^]

Now the problem is I don't know that much about POS Printing from DataGridView Table or something like this.
Any tutorial to print something like this or any related guideline would be much appreciated.
Posted
Comments
[no name] 2-May-14 14:22pm    
http://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument(v=vs.110).aspx
Sergey Alexandrovich Kryukov 2-May-14 16:56pm    
It always seemed weird to me: and what, Computers Showroom will have completely different POS, written by a completely different team of people? And another product for the Jewelry Showroom? And all the sales people should be trained separately to use the POS, by separate trainers? Is that how your business works?
—SA

You only have to create a form with the same design of image receipt. Then pass the data to the form print the form like:
C#
private PrintDocument printDocument1 = new PrintDocument();

public Form1()
{
    InitializeComponents();
    printDocument1.PrintPage += new PrintPageEventHandler(printDocument1_PrintPage);
    this.Controls.Add(printButton);
    CaptureScreen();
    printDocument1.Print();
}


Bitmap memoryImage;

private void CaptureScreen()
{
    Graphics myGraphics = this.CreateGraphics();
    Size s = this.Size;
    memoryImage = new Bitmap(s.Width, s.Height, myGraphics);
    Graphics memoryGraphics = Graphics.FromImage(memoryImage);
    memoryGraphics.CopyFromScreen(this.Location.X, this.Location.Y, 0, 0, s);
}

private void printDocument1_PrintPage(System.Object sender,
       System.Drawing.Printing.PrintPageEventArgs e)
{
    e.Graphics.DrawImage(memoryImage, 0, 0);
}

I don't know what is your data and you can pass the data using different ways. You may provide me the source code and I may be able to help better.
 
Share this answer
 
Comments
[no name] 15-May-14 11:02am    
Can you please specify the source code area? Because I have many sections on that file.. if u indicate me the specific section then it will better for me to provide the source code. And I'm providing a new screenshot of the form... so from there also you can tell me the area which you want... Mainly I need to print the data shown on the datagridview table which highlighted with a red rectangular box.. http://img16.imagevenue.com/aAfkjfp01fo1i-8322/loc464/58383_ss1_122_464lo.jpg
Kelvin Obidozie 17-Sep-19 8:14am    
@khaledkee can you please help with a demo project ..... i have same challenge and cnt get around it.

a format like this ===== Item name | Amount |Discount |VAT

thanks.
Most POS printers do support ESC/POS printer commands which was developed by EPSON. You have to learn ESC/POS and then generate the commands to be sent to the printer. You can use this code to send raw printer commands from your .NET app.
 
Share this answer
 

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