Call Windows operating system printer in Golang.
See http://godoc.org/github.com/godoes/printers for details.
- AddCustomPaperSize: add a custom paper specification to the print server;
- Printer.Forms: get all paper size forms on the print server;
- Printer.Jobs: get all print job information on a printer;
- ReadNames: get printer names on the system;
- SetDefault: set default printer for the system;
- GetDefault: get default printer name on the system;
- ...
go get -d github.com/godoes/printers
📝 Usage
package main
import (
"log"
"github.com/godoes/printers"
)
func main() {
name, err := printers.GetDefault()
if err != nil {
log.Fatalln("GetDefault error:", err)
}
printer, err := printers.Open(name)
if err != nil {
log.Fatalln("Open error:", err)
}
defer func() {
_ = printer.Close()
}()
jobs, err := printer.Jobs()
if err != nil {
log.Fatalln("Jobs error:", err)
}
log.Println("jobs:", jobs)
}
Forked from alexbrainman/printer.