コード例 #1
0
ファイル: test_server.php プロジェクト: pigult/php-ipp
$ipp->setUserName($username);
// setting user name for server
if ($username && $password) {
    $ipp->setAuthentication($username, $password);
}
/* printing an utf-8 file */
$ipp->setDocumentName("test");
$ipp->setCharset('utf-8');
$ipp->setMimeMediaType($mediatype);
$ipp->setData($data);
//String or path to file.
$ipp->setAttribute("requested-attributes", array("copies-supported", "document-format-supported", "printer-is-accepting-jobs", "printer-state", "printer-state-reasons"));
try {
    try {
        if ($get_attributes) {
            printf(_("Get Printer Attributes: %s\n"), $ipp->getPrinterAttributes());
        }
        var_dump($ipp->printer_attributes);
        if ($print) {
            printf(_("Job status: %s\n"), $ipp->printJob());
        }
        // Print job, display job status
    } catch (httpException $e) {
        printf("%s\nerrno: %s\n", $e->getMessage(), $e->getErrno());
        trigger_error("I prefer to quit", E_USER_ERROR);
    }
} catch (ippException $e) {
    printf("%s\nerrno: %s\n", $e->getMessage(), $e->getErrno());
    trigger_error("I prefer to quit", E_USER_ERROR);
}
?>