cups

package module
v0.0.0-...-8508825 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 8, 2019 License: MIT Imports: 2 Imported by: 0

README

go-cups

Experimental Golang bindings for CUPS

Info

This is an experimental library that provides limited bindings to CUPS.

Currently only working on OS X and can print files

Usage

go get https://github.com/vopi181/gcups

Example

package main

import (
    "fmt"

    cups "github.com/vopi181/gcups"
)

func main() {
    printers := cups.NewDefaultConnection()
    for _, dest := range printers.Dests {
        fmt.Printf("%v (%v)\n", dest.Name, dest.Status())
    }
    printers.Dest[0].PrintFile("/tmp/test.txt", "Hello From The Otherside")

}

Credits

Forked from adrianfallerio's go-cups

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	NumDests int
	Dests    []*Dest
	// contains filtered or unexported fields
}

Connection is a struct containing information about a CUPS connection

func NewDefaultConnection

func NewDefaultConnection() *Connection

NewDefaultConnection creates a new default CUPS connection

func (*Connection) Refresh

func (c *Connection) Refresh()

Refresh updates the list of destinations and their state

type Dest

type Dest struct {
	Name      string
	IsDefault bool
	// contains filtered or unexported fields
}

Dest is a struct for each printer

func (*Dest) GetOptions

func (d *Dest) GetOptions() map[string]string

GetOptions returns a map of the dest options

func (*Dest) PrintFile

func (d *Dest) PrintFile(filepath string, jobName string) int

PrintFile prints a single file given the file path and job name

func (*Dest) Status

func (d *Dest) Status() string

Status returns the status of the dest

func (*Dest) TestPrint

func (d *Dest) TestPrint() int

TestPrint prints a test page

func (*Dest) TestPrintCustom

func (d *Dest) TestPrintCustom(filepath string) int

TestPrintCustom prints a custom CUPS testpage given the file path

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL