Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 20th, 2006, 12:13 AM
Registered User
 
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default pos printer

i am wonder if anyone know how to get the pos printer to print using c# codes. I tried the normal method it didn't print anything mostly it just feed in the paper then out come the same blank paper. hope someone can help with this

regards
gret

 
Old January 20th, 2006, 12:28 AM
Friend of Wrox
 
Join Date: Dec 2005
Posts: 132
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to nalla Send a message via Yahoo to nalla
Default


Hi Gret,

What's the method you used to print?
This is what I followed. Please refer this msdn article.
http://msdn.microsoft.com/library/de...PosPrinter.asp

Let us know if you need more information.


nalaka hewage
 
Old January 22nd, 2006, 10:30 PM
Registered User
 
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi,

this is the code i used earlier before i know that the printer was a pos. i saw the article you post read throught it. just download the sdk looking throu the sample now

Code:
System.IO.StreamReader fileToPrint;
System.Drawing.Font printFont;
        protected void button1_Click(object sender, System.EventArgs e)
        {
            string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory); //System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
           fileToPrint = new System.IO.StreamReader(printPath + @"\Kiosk2\printme.txt");
           printFont = new System.Drawing.Font("Arial", 10);
           printDocument1.Print();
           fileToPrint.Close();
        }

        private void printDocument1_printPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            float yPos = 0f;
            int count = 0;
            float leftMargin = e.MarginBounds.Left;
            float topMargin = e.MarginBounds.Top;
            string line = null;
            float linesPerPage = e.MarginBounds.Height/printFont.GetHeight(e.Graphics);
            while (count < linesPerPage)
            {
                line = fileToPrint.ReadLine();
                if (line == null)
            {
                break;
            }
                yPos = topMargin + count * printFont.GetHeight(e.Graphics);
                e.Graphics.DrawString(line, printFont, Brushes.Black, leftMargin, yPos, new StringFormat());
                count++;
            }
            if (line != null)
            {
            e.HasMorePages = true;
            }
        }
 
Old January 23rd, 2006, 09:36 PM
Registered User
 
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Errmmm i tested the application roughly understood what it does. it does a sample application and print to a textbox. i took a look at the code and got a bit confused.. sorry if i am asking stupid question but i am still very new to c#

1) how do you call(Using) the microsoft.PointOfService.
   when i tried on my app but it says "the type or namespace "pos" does not exist in the namespace 'mircosoft(are you missiing an assembly reference?) do i have to take copy the pos file somewhere??? its currently in "program file"

2) how do i print to the printer. i could see the posprinter section of codes getting the text and so on but how do i print to the printer itself?

hope some one can help thanks

regards
gret






Similar Threads
Thread Thread Starter Forum Replies Last Post
POS development. muralish ASP.NET 1.0 and 1.1 Basics 1 November 28th, 2009 04:43 PM
ESC/POS bazani Pro VB 6 5 November 27th, 2009 09:47 PM
ESC/POS jreategui Pro VB 6 1 November 27th, 2009 09:44 PM
ESC / POS Programming John1978 Pro VB 6 3 April 24th, 2007 05:05 PM
Programming for POS systems drasko ASP.NET 1.0 and 1.1 Basics 0 March 12th, 2004 10:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.