开发者

How to print ipp printer setup

So I'm trying to print a file generated by PHP in my localhost through PHP code. I was told to check http://www.nongnu.org/phpprintipp/ and I found this code that they state as the easiest setup in their documentation.

<?php

    require_once(PrintIPP.php);

    $ipp = new PrintIPP();
    $ipp->setHost("localhost");
    $ipp->setPrinterURI("/printers/epson");
    $ipp->setData("./testfiles/test-utf8.txt"); // Path to file.
    $ipp->printJob();

?>

As a beginner, I made this basic l开发者_开发知识库ogic by looking at the code above. First of all, I generate the .txt file through PHP.

Secondly, I create this new instance of the class and so on the objects do the following: find the host (which is localhost in my case, so no need to edit), find the printer, find the text file to be printed (already generated), and do the print job. Yes I know it seems pretty straightforward, but it seems I can't find the printer URI.

How to do that as I am totally unfamiliar to this... I guess the printer must have some kind of IP in the localhost (not sure). If so How can I find it?


Hi!

I'm the PHP::PRINT::IPP author

You'd better to sent to the mailing list (this is a really asynchronous response)

:)

phpprintipp@nongnu.org

  • In first I strongly recommends to check the cvs repository:

    cvs -z3 -d:pserver:anonymous@cvs.savannah.nongnu.org:/sources/phpprintipp co phpprintipp

(you needs cvs program)

  • automagically find printers works only with CUPS server, and I didn't check for 3 years :)

If you print directly to a network printer (without CUPS), or use another IPP server than CUPS:

  • check your printer/server manual for handling of documents formats you whish to use (most probably you'll get only text/plain and PostScript, and as an option for last even on high quality printers, the mime type "application/octet-stream" designates either your printer's language (PCL, ...) -- which is not the standard regarding rfc2911 -- or document format auto-detection which is the standard). You can request for document-format-supported or the whole printer's characteristics with PHP::PRINT::IPP while connected to server (see documentation on main site (URI given at that post end)

  • points your web browser to IP/fqdn of your printer/or print server port 631

    eg:

    http:// xxx . xxx . xxx . xxx : 631
    

(IPv6 addresses are OK too in php::print::ipp, but I never try with a web browser (most probably use brackets [::1]:631))

  • (you are in web browser server-IP:631) check for the "printers" paths eg: "/epson/" => paths are done on "CUPS" basis in BasicIpp:

    public $paths = array(
      "root" => "/",
      "admin" => "/admin/",
      "printers" => "/printers/",
      "jobs" => "/jobs/"
    );
    

    => so

    $ipp->paths = array(
      "root" => "/blah/",
      "admin" => "/bluh/",
      "printers" => "/blih/",
      "jobs" => "/bloh/"
    );
    

    => most probably "/blah/" "/blah/" "/blah/" "/blah/" for the four paths :)

    => can also be "/" for the 4

    ("jobs" designates the jobs (printings) control/check path, and "root", well, if you don't know that then you most probably uses MS-Windows which MS-Windows IPP embedded server will not be usable with that library -- excepting maybe for text/plain)

note: It would be cool if s.o. could install the "PostScript driver" on a MS-Windows server then checks for handling of at least PostScript format with PHP::PRINT::IPP or other IPP clients

  • (you are in web browser server-IP:631) check for your "printer-uri" as done in the print server setup.

    => then :

    $ipp->setPrinterURI($uri)
    

WARNING => this has nothing to do with

setUnix($socket = '/var/run/cups/cups.sock')

nor

setHost($host = 'localhost') + setPort($port = '631')

These 3 last functions gives connectivity to print server

  • => another way to find relevant informations is to print "IPP server/printer setup page" in the printer's menu you'll find on (any ?) network printer hardware. Beware to choose the page which gives you "IPP setup", as most persons are not aware of and sent me "general information" or "general network setup".

main site (links to doc, install, whatever... They are afraid of spam here :)

project / cvs / news

Regards,

TSFH

phpprintipp@nongnu.org

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜