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

printer-ppla

v0.1.3

Published

Creates code in PPLA language for printing on Argox printers

Downloads

15

Readme

Printer PPLA

The package for generating codes in the PPLA language used in Argox thermal printers.

Installing

Using npm

  npm install printer-ppla

Using pnpm

  pnpm add printer-ppla

Using Yarn

  yarn add printer-ppla

Using with typescript

import { Printer, type IConfig } from 'printer-ppla'

const configPrinter: IConfig = {
  width: 330,
  height: 550,
  columns: 3,
  unitMeasurement: 'm',
}

const print = new Printer(configPrinter)
print.addText({
  y: 100,
  x: 50,
  text: 'My first test!',
  direction: Direction.LANDSCAP
})
const printCode = print.build() // get the Buffer

const printCode = print.getCode() // get the code in string

Config (IConfig)

| Parameter | Function | | :---------- | :--------- | | width | width of label | | height | height of label | | columns | number of columns | | marginLeft | margin left | | marginRight | margin right | | spaceBetween | space between each label | | pixelSizeW | width pixel size - default: "2" (0.0049 inch / 0.125 mm for models OS214/OS204/204/X2000+/1000/G6000 and 0.0033 inch / 0.084 mm for models OS314/X3000+/G7000) | | pixelSizeH | height pixel size - default: "2" (see pixelSizeW) | | defaultSaveGraphic | default storage location (A for RAM, B for flash, C for configured default) | | unitMeasurement | unit of measurement ("m" for metric or "n" for inch) | | maximumLength | set maximum lenght of label | | printFunction | function to send data to be printed | | transferType | Sets transfer type | | startposition | Sets print start position | | cutterDispenserConfig | Sets cutter and dispenser configuration | | stopPosition | Sets stop position and automatic back-feed for the label stock | | continuousLength | Sets continuous label length | | heatValue | Sets heat value (2~20) |

Methods

| Methods | Type | Example | | :---------- | :--------- | :--------- | | setConfig | IConfig | .setConfig(myConfig: IConfig) | | setCopies | number | .setCopies(2) | | addBarcode | IBarcode| .addBarcode({ y: 10, x: 10, data: '123456', type: 'A', repeatColumns: true }) | | addBox | IBox | .addBox({ y: 10, x: 10, a: 100, b: 150, s: 10, t: 10, repeatColumns: true }) | | addLine | ILine | .addLine({ y: 10, x: 10, a: 100, b: 150 }) | | addText | IText | .addText({ y: 10, x: 10, text: 'My first test!' }) | | clearMemory | string | .clearMemory(Memory.RAM) | | clearAllMemory | -- | .clearAllMemory() | | sendGraphic | IsendGraphic | .sendGraphic() *see details below | | addGraphic | IGraphic | .addGraphic() *see details below | | deleteGraphic | IDeleteGraphic | .deleteGraphic() *see details below | | addPreCommand | string | .addPreCommand('<STX>M0550<CR>') | | addCommand | string | .addCommand('A2') | | addPostCommand | string | .addPostCommand('<STX>xAGmyimage<CR>') | | build | | .build() *see details below, here | | send | | .send() *see details below, here | | getCode | | .getCode *see details below, here |

Functions

| Functions | Type | Example | return | | :---------- | :--------- | :--------- | :--------- | | resizeBMP | string, IResize | const imgBuffer = resizeBMP(inputPath, { newWidth }) | Buffer of image | | notationToHexReplace | string | notationToHexReplace('<STX>123300002500050G<CR>')| string |

Functions graphic

/*
Function to resize a monochrome bitmap, the printed size can be calculated (depends on the printer - check manual).
For OS-214 Plus with pixelSizeW = 2 (see configPrinter: IConfig) it is 0.250mm per pixel.
*/
const imageBuffer = resizeBMP(bmpFilePath, { newWidth: 50/0.250 }) // 50mm

// or

// Loads the monochrome .bmp image into memory directly from the file
const imageBuffer  = fs.readFileSync(bmpFilePath);

// Sends the image to the printer's memory
print.sendGraphic({ imageBuffer, name: 'myimage' })

// Insert the image into the label
print.addGraphic({ y: 50, x: 50, name: 'myimage' })

// Deletes the image from the printer's memory (optional)
print.deleteGraphic({ name: 'myimage' })

Function getCode

// This function returns the PPLA code in string format
print.getCode();

/* example:
<STX>L<CR>
D11<CR>
141100000800060Test<CR>
E<CR>
*/

Function build

// This function returns the PPLA code in Buffer format
print.build();

Function send


function MyFunctionToSend(dataBuffer: Buffer) {
  // send Buffer to printer
}

const configPrinter: IConfig = {
  width: 330,
  height: 550,
  columns: 3,
  unitMeasurement: 'm',
  printFunction: MyFunctionToSend,
}
const print = new Printer(configPrinter)

print.addText({ y: 10, x: 10, text: 'My first test!' })

// Will use the function to send the Buffer to the printer
print.send();