Skip to content
forked from harf18/escpospi

Java library for ESC/POS compatible Thermal printer from Raspberry Pi

License

Notifications You must be signed in to change notification settings

vowovrz/escpospi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

++++++++++++++
+ Esc/Pos Pi +
++++++++++++++

# Intro

The Esc/Pos Pi Java library provides printing to ESC/POS compatible Thermal printer from Raspberry Pi.
you can print :
- text (many styles and encoding)
- barcode
- QRCode
- Image

->>> Only Serial printers are compatible for now <<<-

It is largely based on python-escpos from Manuel F Martinez (https://github.com/python-escpos/python-escpos)
The code for image printing was written by Gustavo De Micheli (https://github.com/nMoncho)

---------
# Installation

This library uses Pi4J (wich uses WiringPi)
- Install WiringPi : http://wiringpi.com/download-and-install/
- Install Pi4J : http://pi4j.com/install.html
- Using Serial Port
    * Permissions : Add yourself to the uucp group to use the port without sudo
        $sudo usermod -a -G uucp pi
    * Disabling the Serial Console preconfigured for system console (Systemd os like Raspbian Jessie)
        $sudo sed -i.old 's/[^ ]*ttyAMA0[^ ]*//g' /boot/cmdline.txt
        $sudo systemctl disable [email protected]

---------
# HardWare

To connect a serial printer you need a TTL to RS232 adapter ~$3-$10


---------
# Usage

Printer p = new Printer("serial");
try {
    p.open("/dev/ttyAMA0", 9600);
    p.setTextNormal();
    p.printLn("Hello World");
    p.barcode("1324354657687","EAN13",64,2,"","");
    p.printQRCode("WHAT A NICE CODE");
    p.lineBreak();
    p.printImage("myPic.jpg");
} catch (BarcodeSizeError | ConnectionException | IOException | QRCodeException e) {
    e.printStackTrace();
} finally {
    p.cut();
    p.close();
}

About

Java library for ESC/POS compatible Thermal printer from Raspberry Pi

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%