New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

ipp-easyprint

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ipp-easyprint

NPM package that allows easy printing via IPP.

  • 3.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
21
decreased by-22.22%
Maintainers
1
Weekly downloads
 
Created
Source

ipp-easyprint

This NPM package allows for easy interfacing to a network printer via IPP.

This package is build upon the ipp package and my own TS types.

Notice that this package was mainly built for my own needs, and it is therefore not thouroughly tested.

Usage

Set up the printer by providing the HTTP address to the printer.

const printer = new IPPPrinter("http://myprinter.url");

Fetch the current status of the printer. Specific attributes can be requested, and all available attributes can be found at https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/ipp/index.d.ts or https://www.iana.org/assignments/ipp-registrations/ipp-registrations.xhtml#ipp-registrations-2. Get all available attributes by providing "all".

This is a helpful method for getting insight in which job attributes the printer supports.

const status: object = await printer.printerStatus("all");

Setting up the info about a print job. One can either provide a path to the file in disk, or a Buffer. The available job attributes can be found at the URLs above.

const job: IPrintJobInfo = {
  // buffer?: Buffer,
  fileType: "application/pdf",
  jobName: "my awesome job name",
  jobAttributes: {
    "page-ranges": "4-7",
    "print-quality": "high",
    sides: "two-sided-long-edge",
    media: "iso-a4",
  },
  path: "path to file on disk",
  username: "username",
}

The job attributes that you printer supports can be found at status["job-creation-attributes-supported"] and supported and default values for specific attributes, for example the 'sides' attribute, can be found at status["sides-supported"] and status["sides-default"].

The fileType defaults to "application/octet-stream", which signals the printer to try to figure out the file type itself. The most common file types are probably "image/jpeg", "image/png", "text/plain" and "application/pdf".

Send a print job to the printer

const jobId: number = await printFile(job);

Request that the printer identifies itself by beeping and flashing. Available idetification methods are 'display', 'flash', 'sound' and 'speak', but not all printers support all actions.

await printer.identify(status["identify-actions-supported"]);

Keywords

FAQs

Package last updated on 01 Sep 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc