watson / ipp-printer

An IPP printer written in Node.js
MIT License
548 stars 81 forks source link

Airprint #5

Open arlac77 opened 8 years ago

arlac77 commented 8 years ago

Can the printer be advertised in a AirPrint compatible way ?

watson commented 8 years ago

I've not been able to find any documentation describing the AirPrint protocol yet. But it should be possible since Prosto is a commercial AirPrint compatible IPP server.

anthonyringoet commented 8 years ago

You can hardly call it documentation but some more info on airprint vs. bonjour:

watson commented 8 years ago

@anthonyringoet Nice! Thanks :smiley: This will help a lot. There's currently a bug in the subtype implementation of bonjour that I haven't gotten around to fixing yet. So this reminds me that I better get it fixed soon so we can get AirPrint support :smile:

onesail commented 8 years ago

In the meantime on Macs you can do bonjour-advertising with dns-sd.

At this time iOS looks for specific txt-record attributes:

to advertise a service on localhost use:

dns-sd -R "ipp-printer1" _ipp._tcp,_universal . 3000 localhost 192.168.2.102 \
        pdl=application/pdf,image/urf URF=none printer-state=5 \
        rp=ipp ty=CUPS

This allows iOS to discover the service. (printing does not work yet).

KurtPfeifle commented 8 years ago

Actually, the most minimal dns_sd command to let iOS clients accept the registration ("-R") of an AirPrint announcement is this:

    dns-sd                  \
     -R "Fake IPP printer1" \
      _ipp._tcp,_universal  \
      .                     \
      3000                  \
      pdl="image/urf"       \
      URF=""

See also here:

  1. I do not need a TXT record of _ty=CUPS_.
  2. The presence of _URF=""_ is enough for me to get the announcement to "work".
  3. I do not need to list _application/pdf as a supported page description language, **image/urf**_ suffices.

Of course, printing will not work yet either -- but the fake IPP printer will be listed as available.

With no support for application/pdf announced, the iOS clients would of course not send PDF, but URF ("UNIRAST") towards that queue.

brownbl1 commented 6 years ago

@watson Do you have an update on this issue? I'd be very interested in this functionality for a project I'm working on. Great work on this!

ChrisKays commented 6 years ago

Thank you for this article, i am not sure if this is relevant but i would to know if i can achieve the registration/announcemnet using C# and not the command line. e.g: i open a form type the name of the service and pass all other infos then click a button to do the registration and announce the service as airprint. I am currently using MonoZeroconf and am struggling to pass the TXT record URF and pdl, which i assume are vital to make the announcement. Very helpful article by the way.

onesail commented 6 years ago

Look into section "Publish a service" of the documentation:

TxtRecord txt_record = new TxtRecord ();
txt_record.Add ("pdl", "image/urf");
txt_record.Add("URF", "none");
txt_record.Add("ty", "CUPS");
service.TxtRecord = txt_record;

In case you have plans to implement IPP in C# let me know.

ChrisKays commented 6 years ago

@onesail Thank you. Yes, I am planning to implement an IPP server in C#?

ChrisKays commented 6 years ago

@onesail Have you had a chance to Implement IPP server in C#? I need some direction on that.

onesail commented 6 years ago

I am unable to find your personal email. In case you have a business case that involves C# development (preferably open source) feel free to contact me via personal mail.

ChrisKays commented 5 years ago

This thread might be old but just a quick question, When using AirPrint it is possible to specify a username/password combination for authenticated printing. But CUPS (the printing service on iOS) caches the username/password combo once this has been entered and never again shows a prompt except when the whole network setup or the device itself is reset. My question is this, how can i prompt the user to enter his/her credentials? is this achievable in c#?

onesail commented 5 years ago

Yes, you can implement in C# what's specified for IPP:

5.2.7 Security

An IPP Printer [Server] implementation SHOULD contain support for Client Authentication as defined in the IPP/1.1 Encoding and Transport document [RFC2910]. A Printer implementation MAY allow an administrator to configure the Printer so that all, some, or none of the users are authenticated. See also section 8 of this document.