Code Monkey home page Code Monkey logo

dymo-labelmanager's Introduction

txt2img and imgprint -- programs to drive a Dymo LabelManager PNP

by Roger Bell_West (roger at firedrake.org)

Updated versions of this software may be available from
https://github.com/Firedrake/dymo-labelmanager

The Dymo LabelManager PNP is a very fine small tape printer,
conveniently sized and priced for someone like me who has low-volume
label-printing needs.

Unfortunately, because it registers on USB as a HID rather than as a
printer, the Dymo-supplied Linux drivers are of no use with it.

However, the printing protocol is similar to that used on the larger
LabelMaker printers, and writing a program to access it at low level
isn't too hard.

Sebastian Bronner got there first with his dymoprint:
http://sbronner.com/dymoprint.html which is a great starting point, but
wasn't quite what I wanted: it can only produce lines of text in a
single font. In the tradition of Unix programs, I wanted to split the
functions: one program to convert text to bitmap, and another to send
the bitmap to the printer. That way I could use an image editor in
between to add barcodes, multiple fonts, and whatever other functions
I wanted.

Also I like Perl.

And thus txt2img and imgprint. Both of these programs will need the
non-core Imager module (on Debian, apt-get install libimager-perl).


txt2img takes one or more lines of text and an optional font
specifier, and produces a bitmap:

$ txt2img -f /path/to/font.ttf "line one" "line two" "line three"

By default it writes to txt2img.png; -o will change this. It scales
the text to 64 pixels, this being the resolution of the LabelManager
on 12mm tape.

Multiple lines are centred by default; to change this, use "-a l" to
align left or "-a r" to align right.

To increase inter-line spacing, use "-g N" to specify a pixel gap of N.


imgcombine takes several images and combines them into a single one;
for example, you could have a text label from txt2img followed by a
piece of clip-art. -o determines the output file (imgcombine.png by
default). An image that is 64 pixels wide but not high will be
rotated 90 degrees; otherwise it will be scaled to fit.

$ imgcombine file1.png file2.png


imgprint takes a 64-pixel-high image, crudely converts it to
black-and-white if necessary, and outputs it to an attached
LabelManager PNP. If it doesn't find one, it will fail with an error;
you can use the -d option to specify a particular device (or even a
plain file).

Use the "-s" option to print a short label. This will advance the label
past the cutter, but will not include the equal blank space after the
cutter that forms the left margin of the next label to be printed. The
next label printed will be right up at the leading edge of the tape. If
you use this every time, the labels will come out as:

[TEXT    ][TEXT    ] etc.

which may be helpful if you plan to trim off the blank parts anyway.

$ imgprint txt2img.png


If you get a permission error, add a file 50dymo.rules in
/etc/udev/rules.d that reads:

SUBSYSTEM=="hidraw",
ACTION=="add",
ATTRS{idVendor}=="0922",
ATTRS{idProduct}=="1001",
GROUP="plugdev"

then, still as root,

udevadm control --reload-rules && udevadm trigger

Feature requests are welcome.

dymo-labelmanager's People

Contributors

strowger avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.