Trigger a scan from the HP DeskJet 5200 flatbed scanner over the network using eSCL/AirScan. Saves the scanned image to a user-specified location.
Trigger a network scan from the HP DeskJet 5200 using the eSCL (AirScan) protocol.
Read context/printer-config.md for the printer IP.
Verify scanning tools are available:
which scanimage && dpkg -l | grep sane-airscan
If sane-airscan is not installed:
sudo apt install sane-airscan
Check if the scanner is visible:
scanimage -L 2>&1
If no scanner is found, the eSCL endpoint may need manual configuration. Check/create /etc/sane.d/airscan.conf:
grep -q "HP DeskJet 5200" /etc/sane.d/airscan.conf 2>/dev/null || \
echo '[devices]
"HP DeskJet 5200" = http://PRINTER_IP:443/eSCL' | sudo tee -a /etc/sane.d/airscan.conf
Replace PRINTER_IP with the IP from config. Then retry scanimage -L.
If port 443 doesn't work, try port 80:
"HP DeskJet 5200" = http://PRINTER_IP:80/eSCL
Ask the user what they need or use sensible defaults:
| Parameter | Default | Options |
|---|---|---|
| Format | PNG | png, jpeg, tiff, pdf |
| Resolution | 300 DPI | 75, 150, 300, 600 |
| Mode | Color | Color, Gray, Lineart |
| Source | Flatbed | Flatbed (HP 5200 has flatbed only) |
mkdir -p /tmp/hp5200-scans
scanimage -d 'DEVICE_STRING' \
--format=png \
--resolution 300 \
--mode Color \
-o /tmp/hp5200-scans/scan_$(date +%Y%m%d_%H%M%S).png
The DEVICE_STRING comes from scanimage -L output (e.g., airscan:e0:HP DeskJet 5200).
/tmp/hp5200-scans/).convert /tmp/hp5200-scans/scan.png /tmp/hp5200-scans/scan.pdf
(requires ImageMagick)If scanning fails:
sudo scanimage -L (some systems need root for network scanners)