This can be useful for small images, sections of static ZPL that never change, or if you have previously generated ZPL. The Zebra::Zpl::Raw class allows you to supply a raw string of ZPL to include on a label. You can use values between 1 and 5.įor the print modes, you can also use the constants:
More about the possible values below (see Rotation section).
The printer name that you pass in must correspond with the shared printer name on the Windows machine. If using OSX then you will have to manually build it from source and add it to your $PATH environment variable.Ģ.
On a distro such as Ubuntu simply do: sudo apt-get install rlpr LPD Print Service and LPR Port Monitor features enabled on the Windows machine.rlpr installed on the (UNIX) system running your app that uses this gem.In order to print directly to a LPD on a Windows machine you need two things: This gem also supports printing directly to shared printer on Windows using LPD. print label, ip # attempt via rlpr first, fallback to lp Printing directly to Windows LPD print label, ip, print_service: 'rlpr' # attempt only via the rlpr command print_job. print label, ip, print_service: 'lp' # attempt only via the lp command print_job. If left unspecified, it will attempt to send the print job first via rlpr - if the rlpr command fails in anyway then it will fall back to the lp command. You can specify what print service command you want to be used when calling the print method by setting the :print_service option parameter. All the tempfile creation/path resolution, as well as which command has to be used, are handled by the PrintJob class.
This will persist the label contents to a tempfile (using Ruby's tempfile core library) and copy the file to the printer using either rlpr -H -P -o (for Windows systems, see section below) or lp -h -d -o raw (for Unix systems). new ( data: '12345678', position:, height: 50, print_human_readable_code: true, narrow_bar_width: 4, wide_bar_width: 8, type: Zebra:: Zpl:: BarcodeType:: CODE_128_AUTO ) label ' ip = '' # can use 'localhost', '127.0.0.1', or '0.0.0.0' for local machine print_job. new ( width: 200, length: 200, print_speed: 3 ) barcode = Zebra:: Zpl:: Barcode.