W3C home > Mailing lists > Public > public-web-intents@w3.org > January 2012

Re: Proposal for using web intents for a print intent

From: Paul Kinlan <paulkinlan@google.com>
Date: Wed, 25 Jan 2012 18:45:49 -0800
Message-ID: <CADGdg3DNDyMDzNr=x_KYmjVcGbbCMd_9OwRmRSSk6oZNak8RxQ@mail.gmail.com>
To: James Hawkins <jhawkins@chromium.org>
Cc: Dave Raggett <dsr@w3.org>, public-web-intents@w3.org
My use case is for www.imagemator.com to have a print button where I
can go and send the photo directly to Costco's web print service.

Not wanting to speak (but I will take a leap of judgement) for Claes
and Dave, they want to be able to interact with the Device (I have a
couple of partners that I work with that would like the same thing)
directly and be able to manage the printer status, so that they can
interact with the printer to recieve higher level notifications and
also manage the print queue (perhaps to cancel a job) via the app and
not an external manager app.

To this effect I think this can be done with the methods that we have
been discussing in the past.

var channel = new MessageChannel();
var port2 = channel.port2();
var port1 = channel.port1();
port2.onmessage = function(e) {
  if(e.data.message == "notify") { .. }
  if(e.data.message == "ready") { port1.postMessage({ "message" :
"start_job", data: data, options: { media_size: "A4", "color" : true}
});

};
var intent = new Intent("http://webintents.org/print",
"appiliation/x-printer-controler", channel.port1());
window.navigator.startActivity(intent, function() { /* yay */ });

It has some message protocol nitty gritty, but you can abstract that
in a higher level API.

I imagine I would use the Intent system to print as follows:

var urls = ["url1", "url2", "url3"]
var intent = new Intent("http://webintents.org/print",
"appiliation/pdf", urls]);
window.navigator.startActivity(intent, function() { /* yay */ });

With costco being a handler, and just accepting the images I passed in.



On Wed, Jan 25, 2012 at 6:30 PM, James Hawkins <jhawkins@chromium.org> wrote:
> OK I think we're getting closer.  Can you explain this in terms of example
> client(s) and respective service(s)?
>
>
> On Wed, Jan 25, 2012 at 6:28 PM, Paul Kinlan <paulkinlan@google.com> wrote:
>>
>> I know this email was a little more complex way of interacting with
>> printing devices, but the simpler case is much like "share" intent
>> where there a cloud based printing solutions that accept just a PDF or
>> document, the theory being that you "print" a document and via
>> webintents it sends it to an API or service that will render it to
>> paper or something else that can than be mailed to someone.
>>
>> I always imagined it to be something like:
>> +
>> https://printonline.fedex.com/v2.3.0/?s_kwcid=TC|16501|print%20companies||S|b|9706081275&&cmp=KNC-1000441-003-002-0950-0010000-US-US-EN-GPOL00000000000&x=1&s_kwcid=TC|16501|print%20companies||S|b|9706081275
>> Or
>> Costco's send to print images online and then collect them in the
>> store
>> (http://www.costcophotocenter.com/account/login.aspx?ReturnUrl=%2falbum%2f)
>>
>> The verb "save" and "share" doesn't quite fit the intention of the user.
>>
>> On Wed, Jan 25, 2012 at 6:07 PM, James Hawkins <jhawkins@chromium.org>
>> wrote:
>> > What is the use case for this?  What I'm really asking is what do you
>> > need
>> > that is not handled by existing browser printing, e.g., window.print?
>> >
>> > Thanks,
>> > James
>> >
>> > On Wed, Jan 25, 2012 at 3:51 AM, Dave Raggett <dsr@w3.org> wrote:
>> >>
>> >> I spotted an error in my example:
>> >>
>> >> On 25/01/12 11:40, Dave Raggett wrote:
>> >>
>> >> > // now start the activity and redirect
>> >> > // the onSuccess, and onFail functions
>> >> > // to methods on the intent data object
>> >> >
>> >> > window.navigator.startActivity(intent,
>> >> >   function (data) { intent.success(data); },
>> >> >   function (data) { intent.fail(data); }
>> >> > );
>> >>
>> >> Should have been:
>> >>
>> >> window.navigator.startActivity(intent,
>> >>  function (data) { intent.data.success(data); },
>> >>  function (data) { intent.data.fail(data); }
>> >> );
>> >>
>> >> sorry about that.
>> >> --
>> >> Dave Raggett <dsr@w3.org> http://www.w3.org/People/Raggett
>> >>
>> >
>>
>>
>>
>> --
>> Paul Kinlan
>> Developer Advocate @ Google for Chrome and HTML5
>> G+: http://plus.ly/paul.kinlan
>> t: +447730517944
>> tw: @Paul_Kinlan
>> LinkedIn: http://uk.linkedin.com/in/paulkinlan
>> Blog: http://paul.kinlan.me
>> Skype: paul.kinlan
>
>



-- 
Paul Kinlan
Developer Advocate @ Google for Chrome and HTML5
G+: http://plus.ly/paul.kinlan
t: +447730517944
tw: @Paul_Kinlan
LinkedIn: http://uk.linkedin.com/in/paulkinlan
Blog: http://paul.kinlan.me
Skype: paul.kinlan
Received on Thursday, 26 January 2012 02:46:18 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Thursday, 26 January 2012 02:46:18 GMT