1.1.3 • Published 10 months ago

hp-webscan-client v1.1.3

Weekly downloads
-
License
GPL-3
Repository
github
Last release
10 months ago

About

Some HP printers include the webscan protocol. This client can be used to interact with this protocol and request scans from a printer on your local network.

Only tested with HP Envy 6432e.

Setup your printer

In my case, the webscan function of my printer had to be enabled in the webinterface.

For the HP Envy 6432e the setting is located at Settings > Security > Administrator Settings. Check the box next to "Webscan from EWS" and save the changes.

Installation

npm install hp-webscan-client

Usage

import { WebScan } from "hp-webscan-client";

// Create a new WebScan instance
const client = new WebScan({
    ip: "PRINTER_IP",
});

// Start scanning process and save file to output.pdf
client.scanToFile({
    color: true,
    output: {
        format: "application/pdf",
        path: "output.pdf",
    },
});

// Start scanning process and return document as buffer
const buffer = client.scanToBuffer({
    color: true,
    format: "application/pdf",
});

Properties

IScanDocumentOptions

KeyTypeDescriptionRequiredDefault
colorbooleanSet to true for a color scan and false for grayscaleyesnone
sourcestringChoose between "Platen" and "Feeder" where Platen is the glass scanning surface and Feeder is the automatic document feedernoPlaten
outputIScanOutputSpecified the content type and pathyesnone
resolutionintSets the resolution of the scanned document. Lower will be faster. Fixed to 85 when Feeder is set as source.no300
brightnessintThe brightness of the scanfalse1000
contrastintThe contrast of the scanfalse1000

IScanDocumentBufferOptions

KeyTypeDescriptionRequiredDefault
colorbooleanSet to true for a color scan and false for grayscaleyesnone
sourcestringChoose between "Platen" and "Feeder" where Platen is the glass scanning surface and Feeder is the automatic document feedernoPlaten
formatstringSpecified the content type. Choose between "application/pdf" and "image/jpeg"yesnone
resolutionintSets the resolution of the scanned document. Lower will be faster. Fixed to 85 when Feeder is set as source.no300
brightnessintThe brightness of the scanfalse1000
contrastintThe contrast of the scanfalse1000

IScanOutput

KeyTypeDescriptionRequiredDefault
formatstringSpecified the content type. Choose between "application/pdf" and "image/jpeg"yesnone
pathstringPath that the scanned document will be saved atyesnone

WebScan Class

Functions

  • scanToFile
scanToFile(options: IScanDocumentOptions): Promise<void>

This function will initiate a scan and save the scanned document to a local file.

  • scanToBuffer
scanToBuffer(options: IScanDocumentBufferOptions): Promise<Buffer>

This function will initiate a scan and return the scanned document as a buffer.

1.1.3

10 months ago

1.1.2

10 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago