Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 20th, 2006, 12:13 AM
Registered User
 
Join Date: Jan 2006
Location: singapore, singapore, Singapore.
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

Reply With Quote
  #2 (permalink)  
Old January 20th, 2006, 12:28 AM
Friend of Wrox
Points: 464, Level: 7
Points: 464, Level: 7 Points: 464, Level: 7 Points: 464, Level: 7
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Dec 2005
Location: Colombo, , Sri Lanka.
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
Reply With Quote
  #3 (permalink)  
Old January 22nd, 2006, 10:30 PM
Registered User
 
Join Date: Jan 2006
Location: singapore, singapore, Singapore.
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;
            }
        }
Reply With Quote
  #4 (permalink)  
Old January 23rd, 2006, 09:36 PM
Registered User
 
Join Date: Jan 2006
Location: singapore, singapore, Singapore.
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

Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 03:56 AM.


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