Google Groups

Re: WebPrintAPI Proposal

Robert O'Callahan Mar 14, 2012 3:26 PM
Posted in group:
On Wed, Mar 14, 2012 at 9:02 PM, Julian Viereck <> wrote:

> the PDF.JS team is dealing with printing support on the web. I looked at
> what's currently possible with the browser and shared some thoughts about
> it here:
> There are some comments on this G+ post:
> Based on that feedback, I've started on a new WebPrint API proposal, that
> you can find here:
> There isn't too much yet. So far I have scratched out the basic API and
> started some very basic implementation work. However, I hope this is enough
> to get some discussion about this proposed API going and I'd like to get
> some feedback what people think about it.

We need to implement the CSS3 stuff anyway. How about:
-- Implement CSS3 Paged Media sufficient to make headers/footers and
margins go away, select page orientation and size. That shouldn't be too
-- Add an event to canvas that fires per-page during printing to render
that canvas content while we're printing the page it's on. This event would
provide a special canvas context that's compatible with the 2d interface
but internally renders at higher resolution (or possibly emits PS/PDF
Then you could create a print document that's just a series of canvases,
with the appropriate CSS to remove headers/footers/margins etc, and as we
print each page we'll run the callback on each canvas to paint it more
accurately. Any temporary resources could be thrown away after painting
that page.

“You have heard that it was said, ‘Love your neighbor and hate your enemy.’
But I tell you, love your enemies and pray for those who persecute you,
that you may be children of your Father in heaven. ... If you love those
who love you, what reward will you get? Are not even the tax collectors
doing that? And if you greet only your own people, what are you doing more
than others?" [Matthew 5:43-47]