npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lbprint

v1.1.1

Published

Label printing CLI tool

Downloads

26

Readme

lbprint

NPM version

Label printing CLI tool for linux. Supported printers:

  • DYMO LabelManager PnP.
  • Brother PT-P300BT.

Install dependencies

USB printer

Setup udev and modeswitch rules:

# For DYMO LabelManager PnP
curl -fsSL https://raw.githubusercontent.com/puzrin/lbprint/master/support/91-dymo-labelmanager-pnp.rules | sudo tee /etc/udev/rules.d/91-dymo-labelmanager-pnp.rules
curl -fsSL https://raw.githubusercontent.com/puzrin/lbprint/master/support/dymo-labelmanager-pnp.conf | sudo tee /etc/usb_modeswitch.d/dymo-labelmanager-pnp.conf

sudo systemctl restart udev.service

Bluetooth printer

sudo usermod -a -G dialout $USER
# !!! re-login to update group pemissions.

Connect to printer (should be done every time before printer use):

# Get MAC address of PT-P300BT**** (remember it)
hcitool scan
# Connect to printer
sudo rfcomm connect 0 <MAC_ADDRESS> 1 &

Known issue: PT-P300BT falls into error state several seconds after print. Push back button prior to next lbpint run.

Install package

node.js v18+ required (for linux setup via nvm).

# run via npx
npm lbprint -h

# global install
npm i lbprint -g

lbprint -h

# local install from repo
git clone https://github.com/puzrin/lbprint.git
cd lbprint
npm install

./lbprint.js -h

Use

usage: lbprint.js [-h] [-v] [-s <px>] [-g <line-gap>] [-m <px>]
                  [-p {dymo_lm_pnp,view}] [-t <mm>] [-f <name>] [--list-fonts]
                  [--scan] [--viewer <program>]
                  [text ...]

positional arguments:
  text                  text to print, each parameter gives a new line

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -s <px>, --font-size <px>
                        font size (pixels, use max possible if not set)
  -g <line-gap>, --line-gap <line-gap>
                        space between lines (pixels or "rem", 0.1rem by
                        default)
  -m <px>, --margin <px>
                        text horizontal margin (pixels, 30 by default)
  -p {dymo_lm_pnp,brother_ptp300bt,view}, --printer {dymo_lm_pnp,view}
                        printer to use (auto-detect by default)
  -t <mm>, --type-width <mm>
                        label type width (12 by default)
  -f <name>, --font <name>
                        font to use (file name for embedded, or full path for
                        the rest)
  --list-fonts          list available embedded fonts
  --scan                search & show available printers
  --viewer <program>    program to use for image view ('display' by default)

Note:

  • By default Roboto Regular (scaleable) font is used. Use --list-fonts to see all embedded alternatives.
  • For small sizes you may wish o use helvR<08|10|12|14>.bdf font.

Any external BDF/TTF/WOFF fonts are allowed too, if full path provided.

Examples

Print 2 lines of max possible size with default font:

lbprint 'foo bar' baz

Print 3 lines with fixed size Helvetica font, and minimal line gap.

lbprint -f helvR12.bdf -g0 foo bar baz

View only:

# use default viewer
lbprint -p view 'foo bar'

# specify custom viewer
lbprint -p view --viewer display 'foo bar'