Thread: How to code a program to print receipt with my input with ESC/POS

  1. #1
    Registered User
    Join Date
    Mar 2019
    Posts
    50

    How to code a program to print receipt with my input with ESC/POS

    Title was supposed to say, to print receipt with ESC/POS commands as output
    If i use an espon receipt printer compatible with esc/pos commands, how do i set the output to the receipt printer? Is this doable? Ive already seen it done in PHP, and c# but i don’t know anything about either of these languages. Anything I should know about the project? Basically my plan is to have the program ask for the all the information and generate a receipt as output(Well, technically the esc commands TO GENERATE the receipt). If you don’t know anything about ESC/POS or what I’m trying to do that’s fine, any help would be gladly appreciated. This is my first really big project that involves any hardware. Thanks a million guys!
    https://mike42.me/blog/what-is-escpo...ow-do-i-use-it
    http://content.epson.de/fileadmin/content/files/RSD/downloads/escpos.pdf
    Last edited by Ctylersills; 05-16-2019 at 12:16 AM. Reason: Specificity/TYPO

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Quote Originally Posted by Ctylersills
    Ive already seen it done in PHP, and c# but i don’t know anything about either of these languages.
    If you link to the PHP and C# code that you have seen, it might be easier to help you along. As it stands, what you're asking for sounds like it depends on the hardware.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    src.zipexs.zipI hope these are showings up on your guys’s end, the code is available on the github site I linked; the first one i believe links right to the repo, and you can click download. I just didn’t upload because it exceeds my files limits, and in honesty, I BLOW at uploading files to forums. please, no judgments. If this doesn’t work ill try again in a little bit. I zipped what i felt were the most necessary files for you to peruse LL, windows interface, example encoding structre, base classes and code etc. If there’s anything else you need let me know and ill be happy to try my best (not very good like i said) to get those files up here individually. On ipad till tomorrow.
    Last edited by Ctylersills; 05-16-2019 at 06:37 PM. Reason: Typo

  4. #4
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    The c# code is a nuget package, i tried to wing it on c# but when i installed the package in VS 2019 it wouldn’t link or show the library and kept giving me an error message about the incompatibility between .net versions. Do you know how i could acces the underlying code on the web and get the source code?

  5. #5
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    You might want to examine the PHP version then as the code is on GitHub. The example on mike42's blog with reference to the library on GitHub shows the code basically opening a particular device as a file, then writing to the "file". The code for what to write looks well documented, so you can translate it into C++.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  6. #6
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    Quote Originally Posted by laserlight View Post
    You might want to examine the PHP version then as the code is on GitHub. The example on mike42's blog with reference to the library on GitHub shows the code basically opening a particular device as a file, then writing to the "file". The code for what to write looks well documented, so you can translate it into C++.
    Ok, so basically sending all the print commands to the print buffer, am I right, saying that the print buffer file be written to, as output?
    Last edited by Ctylersills; 05-16-2019 at 09:42 PM. Reason: Wrong language

  7. #7
    Registered User
    Join Date
    Mar 2019
    Posts
    50
    how would I get the source code from a nuget package? I’m thinking it would probably be MUCH easier to translate from c#

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Printing the receipt
    By SiriusWhite in forum C Programming
    Replies: 1
    Last Post: 03-11-2014, 09:12 AM
  2. Printing Receipt using C programming
    By danial92 in forum C Programming
    Replies: 8
    Last Post: 08-30-2011, 01:31 PM
  3. Replies: 2
    Last Post: 07-29-2011, 07:02 AM
  4. Receipt Machine in C
    By subwaybusker in forum C Programming
    Replies: 2
    Last Post: 10-21-2008, 12:18 PM
  5. Replies: 1
    Last Post: 10-01-2001, 10:39 AM

Tags for this Thread