TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published


build Build Status npm npm Docker Pulls Gitter CodeFactor FOSSA Status

Little command line program that allow to send scan from device to computer.

Can be run with npx : npx node-hp-scan-to or with Docker (see below)

Developed and tested for the following HP All-in-One Printers:

  • HP Officejet 6500A Plus
  • HP Deskjet 3520
  • HP Smart Tank Plus 570 series

The following printer are also working:

  • HP Deskjet 3050 All-in-One Printer - J610a
  • HP Officejet 5230
  • HP Officejet 6700 premium
  • HP Officejet 5740
  • HP Officejet 6950
  • HP OfficeJet Pro 8025e

There are good chances it also works on your HP All-in-One Printer. For this purpose, the original HP Windows application's interaction with the device has been reverse engineered.

This project is not endorsed by nor affiliated with HP.

Supported features

  • ✔️ JPG scan output
  • ✔️ PDF document scan output
  • ✔️ Scan from automatic document feeder
  • ✔️ Dual side with automatic document feeder
  • ✔️ Multi page from platen
  • ✔️ Automatic IP address discovery
  • ✔️ Prebuilt Docker images (multi arch)
  • ✔️ Command line support (Cross platform)
  • ✔️ Customizable file names
  • ✔️ Customizable resolution
  • ✔️ Customizable label on the device


Command line

npx node-hp-scan-to

  • -ip or --address followed by the ip address of the printer, i.e. -ip This overrides -p.
  • -l or --label The label to display on the printer (default is the hostname).
  • -n or --name followed by the printer name, it probably contains spaces, so it needs to be quoted, i.e. -name "Officejet 6500 E710n-z"
  • -d or --directory followed by the directory path where the scanned documents should be saved, i.e. -d ~/Documents/Scans. Defaults to /tmp/scan-to-pc<random value> when not set.
  • -t or --temp-directory Temp directory used for processing. Defaults to /tmp/scan-to-pc<random value> when not set.
  • -p or --pattern followed by the pattern for the filename without file extension, i.e. "scan" to name the scanned file scan_19.04.2021_17:26:47. Date and time patterns are replaced by the current date and time, text that should not be replaced need to be inside quotes. Documentation for the pattern can be found here in the section Mask options. Defaults to scan<increasing number>_page<page number> when not set.
  • -r or --resolution Resolution in DPI of the scans (defaults is 200).
  • -D, --debug" enables debug logs.

If you wish to test it by cloning this repository:

git clone ...
cd node-hp-scan-to
yarn install -d
yarn build
# now start the program with the ip or name of the desired printer
node dist/index.js -ip # or -n "Officejet 6500 E710n-z"

Run with docker

Be aware that with docker you have to specify the ip address of the printer via the IP environment variable, because bonjour service discovery uses multicast network traffic which by default doesn't work in docker. You could however use docker's macvlan networking, this way you can use service discovery and the NAME environment variable.

All scanned files are written to the volume /scan, the filename can be changed with the PATTERN environment variable. For the correct permissions to the volume set the environment variables PUID and PGID.

To enable debug logs set the environment variable CMDLINE to -D. Can also be used for any other command line parameters.

The name shown on the printer's display is the hostname of the docker container, which defaults to a random value, so you may want to specify it via the -hostname argument.

Example for docker:

git clone ...
cd node-hp-scan-to
docker build . -t node-hp-scan-to
docker run -e IP= -e PGID=1000 -e PUID=1000 --hostname scan node-hp-scan-to

Example for docker-compose: Write the following docker-compose.yml file into this directory:

version: "3"

      context: .
      dockerfile: Dockerfile
    container_name: node-hp-scan-to
    hostname: scan
      - IP=
      - PATTERN="scan"
      - PGID=1000
      - PUID=1000
      - TZ=Europe/London
      - /some/host/directory/or/volume:/scan
    restart: always

Then run docker-compose up -d --build. To

Public Pre-built Docker image:


I'm using Visual Studio Code to debug this application, so instead of running ts-node just enter code . and press F5 to start debugging. You may want to set your printers ip or name in .vscode/launch.json.

💖 Support this project

If this project helped you save money or time or simply makes your life also easier, you can give me a cup of coffee =)

  • Support via PayPal
  • Bitcoin — You can send me bitcoins at this address: 33gxVjey6g4Beha26fSQZLFfWWndT1oY3F


FOSSA Status


DownloadsWeekly Downloads






Unpacked Size

781 kB

Total Files


Last publish


  • manuc66