moved the PrintTestPage Function to the cups client
This commit is contained in:
parent
03317e6333
commit
31b9eb5010
|
@ -1,6 +1,9 @@
|
|||
package ipp
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"bytes"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type CUPSClient struct {
|
||||
*IPPClient
|
||||
|
@ -269,3 +272,24 @@ func (c *CUPSClient) GetClasses(attributes []string) (map[string]Attributes, err
|
|||
|
||||
return printerNameMap, nil
|
||||
}
|
||||
|
||||
// PrintTestPage prints a test page of type application/vnd.cups-pdf-banner
|
||||
func (c *CUPSClient) PrintTestPage(printer string) (int, error) {
|
||||
testPage := new(bytes.Buffer)
|
||||
testPage.WriteString("#PDF-BANNER\n")
|
||||
testPage.WriteString("Template default-testpage.pdf\n")
|
||||
testPage.WriteString("Show printer-name printer-info printer-location printer-make-and-model printer-driver-name")
|
||||
testPage.WriteString("printer-driver-version paper-size imageable-area job-id options time-at-creation")
|
||||
testPage.WriteString("time-at-processing\n\n")
|
||||
|
||||
return c.PrintDocuments([]Document{
|
||||
{
|
||||
Document: testPage,
|
||||
Name: "Test Page",
|
||||
Size: testPage.Len(),
|
||||
MimeType: MimeTypePostscript,
|
||||
},
|
||||
}, printer, map[string]interface{}{
|
||||
AttributeJobName: "Test Page",
|
||||
})
|
||||
}
|
||||
|
|
|
@ -389,27 +389,6 @@ func (c *IPPClient) HoldJobUntil(jobID int, holdUntil string) error {
|
|||
return err
|
||||
}
|
||||
|
||||
// PrintTestPage prints a test page of type application/vnd.cups-pdf-banner
|
||||
func (c *IPPClient) PrintTestPage(printer string) (int, error) {
|
||||
testPage := new(bytes.Buffer)
|
||||
testPage.WriteString("#PDF-BANNER\n")
|
||||
testPage.WriteString("Template default-testpage.pdf\n")
|
||||
testPage.WriteString("Show printer-name printer-info printer-location printer-make-and-model printer-driver-name")
|
||||
testPage.WriteString("printer-driver-version paper-size imageable-area job-id options time-at-creation")
|
||||
testPage.WriteString("time-at-processing\n\n")
|
||||
|
||||
return c.PrintDocuments([]Document{
|
||||
{
|
||||
Document: testPage,
|
||||
Name: "Test Page",
|
||||
Size: testPage.Len(),
|
||||
MimeType: MimeTypePostscript,
|
||||
},
|
||||
}, printer, map[string]interface{}{
|
||||
AttributeJobName: "Test Page",
|
||||
})
|
||||
}
|
||||
|
||||
// TestConnection tests if a tcp connection to the remote server is possible
|
||||
func (c *IPPClient) TestConnection() error {
|
||||
conn, err := net.Dial("tcp", fmt.Sprintf("%s:%d", c.host, c.port))
|
||||
|
|
Loading…
Reference in New Issue