Labelprinter

From NURDspace
Revision as of 21:18, 23 March 2019 by Dennis (talk | contribs) (→‎Via irc)
Label Printer
Labelprinter.jpg
Owner Space
Status Infrastructure
Location SlabPi
Tool Yes
Tool category General

Label Printer

Labelprinter.jpg {{{InventoryOwner}}}Property "Tool Owner" (as page type) with input value "{{{InventoryOwner}}}" contains invalid characters or is incomplete and therefore can cause unexpected results during a query or annotation process. SlabPi

Description

This is the label printer.

Drivers + entry in cups is on the SlabPi at the moment.

How to use

Via irc

  • Use !label

If you have the right permissions and the bot can reach SlabPi you should see Nurdbot telling you that it is printing your text. Right now the bot has no way of knowing that stuff will actually be printed at SlabPi.

What hardware is this

  • Seiko SLP-650
  • 99014 Shipping Labels
  • Use 'paper size 'Shipping (SLP-SRL)

Known issues

Label alignment

Do not print multiple labels at once. After each print, you should correct for the fact that the will not be correctly fed. You need to adjust for that by hand.

Printer disabled

Sometimes it just stops working at all, that is, the bot will tell you it is printing, but no label is coming out. Somehow the printer gets disabled sometimes. All commands below should be executed on SlabPi.

  • Check the status

lpstat -p If you see output like this, the printer is disabled indeed: printer SII_SLP650 disabled since Sat 23 Mar 2019 08:30:04 PM CET - Unable to send data to printer.

If you did multiple failed tries, you should probably empty the queue first.

  • See what's in the queue

lpstat

  • Delete something from the queue (ID is 339 in this example)

cancel -a SII_SLP650-339

  • If the queue is empty, you can enable the labelprinter like this:

cupsenable SII_SLP650

Tips for making excellent labels (tbd)

These tips are saved for posterity. For now only !label kan be used.

  • There is no grayscale, make images 1 bit color (and use floyd-steinberg (normal) dithering if needed, looks teh best :) )
  • There are a couple of previously printed labels in de homedir of user "printer" (/printerhome/ on Printer-desktop) which can easily be re-used.
  • For text only, you can use !label @ Nurdbot

How does the printing from Nurdbot work?

Scripts in /home/labelprinter gets executed from Nurdbot. For now it's label.sh which takes an empty label and puts text in there using imagemagick which gets printed.

label.sh

Script that is called to do the printing.

#!/bin/bash
# Takes arguments and puts it as text in a templated label for our labelprinter
if [[ $# -eq 0 ]] ; then
    echo 'No arguments given, exiting...'
    exit 0
fi
echo $*
if [ "$(echo $1 | awk '{print substr($0,0,3)}')" == "0x" ] ; then
#This is a sanitised input from nurdbot.
#INPUT=$(python3 -c "print(bytes.fromhex('$1'.strip()[2:]).decode('utf8'))")
INPUT=$(python -c "print('$1'[2:].decode('hex'))")
else
INPUT="$*"
fi
echo $INPUT
cd /home/labelprinter/nurdbotlabelprinting/
cp empty.png output.png
convert output.png output.gif
convert output.gif -background none -font "Garuda.ttf"  -gravity Center\
 -size 744x377 caption:"$INPUT" -layers flatten output.gif

convert output.gif -rotate 90 output.gif

# lpr -PSII_SLP650 output.gif
# lp -o landscape -o fit-to-page -o media=Shipping -d SII_SLP650 output.gif

# print!
lp -d SII_SLP650 output.gif

# qiv output.gif
echo $INPUT >> label.log

#code for moving to next empty label but it's not reliable
#printf "\f" |lpr -P SLP650

PPD that seems to work

*PPD-Adobe: "4.3"
*%%%% PPD file for SLP650/SLP650SE with CUPS.
*%%%% Created by the CUPS PPD Compiler CUPS v1.5.3.
*% Seiko Instruments Inc Smart Label Printer PPD file for
*% the Common UNIX Printing System (CUPS).
*% Copyright 1997-2003 by Easy Software Products.
*% These coded instructions, statements, and computer programs are the
*% property of Easy Software Products and are pr
*FormatVersion: "4.3"
*FileVersion: "13.37"
*LanguageVersion: English
*LanguageEncoding: ISOLatin1
*PCFileName: "siislp650-NURD.ppd"
*Product: "(SII SLP650)"
*Manufacturer: "SII"
*ModelName: "SII SLP650/NURD"
*ShortNickName: "SII SLP650/NURD"
*NickName: "SII SLP650/NURD, 13.37"
*PSVersion: "(3010.000) 550"
*LanguageLevel: "3"
*ColorDevice: False
*DefaultColorSpace: Gray
*FileSystem: False
*Throughput: "25"
*LandscapeOrientation: Plus90
*TTRasterizer: Type42
*% Driver-defined attributes...
*APPrinterIconPath: "/Library/Printers/SII/rastertosiislp.app/Contents/Resources/DriverIcons/slp650.icns"
*cupsVersion: 1.5
*cupsModelNumber: 294
*cupsManualCopies: False
*cupsFilter: "application/vnd.cups-raster 0 /usr/lib/cups/filter/seikoslp.rastertolabel"
*cupsLanguages: "en"
*OpenUI *PageSize/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageSize
*DefaultPageSize: Nurds
*PageSize Nurds/Nurds (SLP-NURD): "<</PageSize[153 268]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageSize
*OpenUI *PageRegion/Media Size: PickOne
*OrderDependency: 10 AnySetup *PageRegion
*DefaultPageRegion: Nurds
*PageRegion Nurds/Nurds (SLP-NURD): "<</PageSize[153 268]/ImagingBBox null>>setpagedevice"
*CloseUI: *PageRegion
*DefaultImageableArea: Nurds
*ImageableArea Nurds/Nurds (SLP-NURD): "0 0 153.071 286.299"
*DefaultPaperDimension: Nurds
*PaperDimension Nurds/Nurds (SLP-NURD): "153.071 286.299"
*MaxMediaWidth: "153"
*MaxMediaHeight: "268"
*HWMargins: 0 0 0 0
*CustomPageSize True: "pop pop pop <</PageSize[5 -2 roll]/ImagingBBox null>>setpagedevice"
*ParamCustomPageSize Width: 1 points 36 153
*ParamCustomPageSize Height: 2 points 36 268
*ParamCustomPageSize WidthOffset: 3 points 0 0
*ParamCustomPageSize HeightOffset: 4 points 0 0
*ParamCustomPageSize Orientation: 5 int 0 0
*OpenUI *Resolution/Resolution: PickOne
*OrderDependency: 10 AnySetup *Resolution
*DefaultResolution: 300dpi
*Resolution 300dpi/300 DPI: "<</HWResolution[300 300]/cupsBitsPerColor 1/cupsRowCount 0/cupsRowFeed 0/cupsRowStep 0/cupsColorSpace 3>>setpagedevice"
*CloseUI: *Resolution
*OpenGroup: SIISLPOptions/SIISLPOptions
*OpenUI *Density/Output Quality: PickOne
*OrderDependency: 10 AnySetup *Density
*DefaultDensity: MediumQuality
*Density LowQuality/Low: ""
*Density MediumQuality/Medium: ""
*Density HighQuality/High: ""
*CloseUI: *Density
*OpenUI *FinePrint/Fine Print: Boolean
*OrderDependency: 10 AnySetup *FinePrint
*DefaultFinePrint: False
*FinePrint True/1: ""
*FinePrint False/0: ""
*CloseUI: *FinePrint
*CloseGroup: SIISLPOptions
*DefaultFont: Courier
*Font AvantGarde-Book: Standard "(1.05)" Standard ROM
*Font AvantGarde-BookOblique: Standard "(1.05)" Standard ROM
*Font AvantGarde-Demi: Standard "(1.05)" Standard ROM
*Font AvantGarde-DemiOblique: Standard "(1.05)" Standard ROM
*Font Bookman-Demi: Standard "(1.05)" Standard ROM
*Font Bookman-DemiItalic: Standard "(1.05)" Standard ROM
*Font Bookman-Light: Standard "(1.05)" Standard ROM
*Font Bookman-LightItalic: Standard "(1.05)" Standard ROM
*Font Courier: Standard "(1.05)" Standard ROM
*Font Courier-Bold: Standard "(1.05)" Standard ROM
*Font Courier-BoldOblique: Standard "(1.05)" Standard ROM
*Font Courier-Oblique: Standard "(1.05)" Standard ROM
*Font Helvetica: Standard "(1.05)" Standard ROM
*Font Helvetica-Bold: Standard "(1.05)" Standard ROM
*Font Helvetica-BoldOblique: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow-Bold: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow-BoldOblique: Standard "(1.05)" Standard ROM
*Font Helvetica-Narrow-Oblique: Standard "(1.05)" Standard ROM
*Font Helvetica-Oblique: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-Bold: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-BoldItalic: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-Italic: Standard "(1.05)" Standard ROM
*Font NewCenturySchlbk-Roman: Standard "(1.05)" Standard ROM
*Font Palatino-Bold: Standard "(1.05)" Standard ROM
*Font Palatino-BoldItalic: Standard "(1.05)" Standard ROM
*Font Palatino-Italic: Standard "(1.05)" Standard ROM
*Font Palatino-Roman: Standard "(1.05)" Standard ROM
*Font Symbol: Special "(001.005)" Special ROM
*Font Times-Bold: Standard "(1.05)" Standard ROM
*Font Times-BoldItalic: Standard "(1.05)" Standard ROM
*Font Times-Italic: Standard "(1.05)" Standard ROM
*Font Times-Roman: Standard "(1.05)" Standard ROM
*Font ZapfChancery-MediumItalic: Standard "(1.05)" Standard ROM
*Font ZapfDingbats: Special "(001.005)" Special ROM
*% End of siislp650.ppd, 14340 bytes.