download deps before build

This commit is contained in:
evan 2020-05-07 23:37:00 -05:00
parent 38570354d0
commit 1c26f7be06
4 changed files with 8 additions and 1 deletions

View file

@ -2,7 +2,7 @@
host=10.11.99.1
printer.arm:
go get
go get ./...
env GOOS=linux GOARCH=arm GOARM=5 go build -o printer.arm
printer.x86:

View file

@ -42,6 +42,12 @@ See [Add a network printer by its IP address](https://support.apple.com/guide/ma
No authentication, so keep WiFi off while not in use.
## How it works
Virtually all network printers accept raw Postscript/PDF data on TCP port 9100 via the Appsocket/HP Jetdirect protocol. Sometimes this data is preceded by a few plaintext lines telling the printer information such as the print job name and print settings.
This script simply listens on TCP 9100 and waits for a PDF header, then begins saving data to a pdf file (while also creating the accompanying .metadata file). The output filename is extracted from the print job name line, if it exists.
## Testing on host
$ make printer.x86

BIN
img.jpg

Binary file not shown.

Before

Width:  |  Height:  |  Size: 225 KiB

View file

@ -128,6 +128,7 @@ func handleRequest(conn net.Conn) {
title = strings.Split(line, "\"")[1]
debug("Setting title to", title)
}
// PDF section started
if strings.HasPrefix(line, "%PDF-") {
debug("PDF begin")
_, err := f.WriteString(line)