watson/ipp-printer

Airprint

Opened this issue ยท 13 comments

Can the printer be advertised in a AirPrint compatible way ?

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 Nice! Thanks ๐Ÿ˜ƒ 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 ๐Ÿ˜„

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

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

  • pdl=application/pdf,image/urf
  • URF=none (must not be empty)
  • ty=CUPS (must not be empty)

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).

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.

@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!

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.

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.

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

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

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.

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#?

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.