The airscan
Go package can be used to scan paper documents 📄 from a scanner
🖨️ via the network 🕸️ using the Apple AirScan (eSCL) protocol.
First, install the example program coming with this package:
go install -v github.com/stapelberg/airscan/cmd/airscan1@latest
Then, query the local network for AirScan compatible devices:
% airscan1
2020/08/16 08:50:31 finding airscan-compatible devices for 1s
2020/08/16 08:50:31 device "Brother MFC-L2750DW series" discovered (use -host="BRW405BD8AxxDyz")
Now, I can scan the contents of the flatbed scanner:
% airscan1 -host=BRW405BD8AxxDyz
2020/08/16 08:52:44 finding device for 5s (use -timeout=0 for unlimited)
2020/08/16 08:52:45 device "Brother MFC-L2750DW series" found in 298.151935ms
2020/08/16 08:52:51 scan done in 6.738205326s
…or the page(s) inserted into the Automatic Document Feeder (ADF):
% airscan1 -host=BRW405BD8A10D7C -source=adf
2020/08/16 11:10:34 finding device for 5s (use -timeout=0 for unlimited)
2020/08/16 11:10:34 device "Brother MFC-L2750DW series" found in 112.127399ms
2020/08/16 11:10:45 wrote /tmp/page12.jpg (211305 bytes)
2020/08/16 11:10:47 wrote /tmp/page13.jpg (139335 bytes)
2020/08/16 11:10:47 scan done in 13.068799513s
…or the page(s) from ADF, colored, and as single PDF file output:
% airscan1 -host=HPFXXXXXXXXXXXX -source adf -color RGB24 -format "application/pdf"
2021/04/04 00:12:13 finding device for 5s (use -timeout=0 for unlimited)
2021/04/04 00:12:14 device "HP OfficeJet Pro 9010 series" found in 315.486148ms
2021/04/04 00:14:07 wrote /tmp/page5.pdf (123456 bytes)
2021/04/04 00:14:07 scan done in 1m53.772520178s
See the package airscan examples in godoc for how to use the package to scan.
See airscan1.go for a full example scan program, including network service discovery, timeouts, and writing scan data to files.
The package does what I needed: grayscale/color scan of A4 documents from the flat bed or the automatic document feeder (ADF).
If you have any improvements, I’d be happy to review a pull request. Please see the contribution guidelines.
If you successfully scanned documents from your device using the airscan1
example program as described above, please send a pull
request to include
your report in this table for the benefit of other interested users:
Device Name | Working features | Known issues |
---|---|---|
Brother MFC-L2710DN | flat bed scan, automatic document feeder scan | must be run with -duplex=false |
Brother MFC-L2750DW | flat bed scan, automatic document feeder scan | |
Canon G3560 | flat bed scan, color: RGB24 | |
Epson XP-7100 | flat bed scan, automatic document feeder scan | must be run with -duplex=false for flat bed scanning; also needs -skip_cert_verify |
HP Laserjet M479fdw | flat bed scan, automatic document feeder scan | |
HP OfficeJet Pro 9010 series | flat bed scan, automatic document feeder scan, color: RGB24 |