function print_job($job) { global $sql; $settings = new settings_tool(); $speed = $sql->q1($settings->single_query(-1, $this->name . '.speed', $_SESSION['uid'], 0)); if (!isset($speed)) { $speed = 5; } $density = $sql->q1($settings->single_query(-1, $this->name . '.density', $_SESSION['uid'], 0)); if (!isset($density)) { $density = 4; } $ipp_host = $sql->q1($settings->single_query(-1, $this->name . '.ipp_host', $_SESSION['uid'], 0)); if (!isset($ipp_host)) { $ipp_host = 'localhost'; } $ipp_printer = $sql->q1($settings->single_query(-1, $this->name . '.ipp_printer', $_SESSION['uid'], 0)); if (!isset($ipp_printer)) { $ipp_printer = '/printers/TLP2824_'; } $ipp = new PrintIPP(); $ipp->setHost($ipp_host); $ipp->setPrinterURI($ipp_printer); $ipp->setData("\nS" . $speed . "\nD" . $density . "\n" . $job); $ipp->setRawText(); $ipp->printJob(); }
function print_prenote($folio, $ip) { require_once 'printIPP/PrintIPP.php'; try { $ipp = new PrintIPP(); $ipp->setHost($ip); $ipp->setPrinterURI($ip); $ipp->setCharset("UTF-8"); $ipp->setData($folio . ".pdf"); if (($status = $ipp->printJob($folio)) == "successfull-ok") { return true; } else { error_log($status); return false; } } catch (Exception $ex) { error_log('ex...' + $ex->getErrorFormatted()); return false; } }
* this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * mailto:thomas.harding@laposte.net * */ error_reporting(E_ALL | E_STRICT); if (!isset($argv[1])) { echo "usage: ", $argv[0], ' "file"|"string"', "\n"; exit(1); } $user = getenv('USER'); require_once "printipp/PrintIPP.php"; $ipp = new PrintIPP(); $ipp->setUnix(); $ipp->setPrinterUri("ipp://localhost:631/printers/Parallel_Port_1"); $ipp->setData($argv[1]); $ipp->setUserName($user); echo "printing job: ", $ipp->printJob(), "\n"; echo "cancelling job: ", $ipp->cancelJob($ipp->last_job), "\n";
<?php set_include_path($_SERVER['DOCUMENT_ROOT']); require_once 'lib/ipp/PrintIPP.php'; require_once 'lib/utils.php'; $ipp_host = $_GET["host"]; $ipp_printer = $_GET["printer"]; $task = $_GET["task"]; $json = file_get_contents("http://api.dveri.ru/?method=CRM&json=" . urlencode('{"packet":{"ACTION":"BarCodeAPI.GetTask","DATA":{"taskId":"' . js_escape($task) . '"}},"protocol":"0.3"}')); header("Content-type: text/plain; charset=\"UTF-8\""); $a = json_decode($json, true); if (is_null($a)) { print "F**k the f*****g m**********r off!!!!!\n"; print "This is not JSON:\n"; print $json; exit; } if ($a["packet"]["RESULT"] == "OK") { $ipp = new PrintIPP(); $ipp->setHost($ipp_host); $ipp->setPrinterURI($ipp_printer); $ipp->setData($printjob); $ipp->setRawText($a["packet"]["DATA"]["Result"]); $ipp->printJob(); } else { print "Something bad has happened...\n"; print $a["packet"]["RESULT"] . "\n"; print $a["packet"]["ERRORMSG"] . "\n"; }