mirror of
https://github.com/Evidlo/remarkable_printer.git
synced 2024-10-20 11:37:35 -04:00
download deps before build
This commit is contained in:
parent
38570354d0
commit
1c26f7be06
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@
|
||||||
host=10.11.99.1
|
host=10.11.99.1
|
||||||
|
|
||||||
printer.arm:
|
printer.arm:
|
||||||
go get
|
go get ./...
|
||||||
env GOOS=linux GOARCH=arm GOARM=5 go build -o printer.arm
|
env GOOS=linux GOARCH=arm GOARM=5 go build -o printer.arm
|
||||||
|
|
||||||
printer.x86:
|
printer.x86:
|
||||||
|
|
|
@ -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.
|
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
|
## Testing on host
|
||||||
|
|
||||||
$ make printer.x86
|
$ make printer.x86
|
||||||
|
|
1
main.go
1
main.go
|
@ -128,6 +128,7 @@ func handleRequest(conn net.Conn) {
|
||||||
title = strings.Split(line, "\"")[1]
|
title = strings.Split(line, "\"")[1]
|
||||||
debug("Setting title to", title)
|
debug("Setting title to", title)
|
||||||
}
|
}
|
||||||
|
// PDF section started
|
||||||
if strings.HasPrefix(line, "%PDF-") {
|
if strings.HasPrefix(line, "%PDF-") {
|
||||||
debug("PDF begin")
|
debug("PDF begin")
|
||||||
_, err := f.WriteString(line)
|
_, err := f.WriteString(line)
|
||||||
|
|
Loading…
Reference in a new issue