
Firefox introduces PDF viewer - riledhel
http://blog.mozilla.org/blog/2013/02/19/firefox-introduces-pdf-viewer-to-browse-the-web-without-interruption
======
hosay123
It's worth pointing out this is done in _pure Javascript_ , and works by
compiling PDF functions to equivalent Javascript functions which are then
visible to Firefox's JIT. Despite being only around a year old, it still
manages to render the majority of PDFs thrown at it (it's been my primary
paper reader for the past 6 months or so).

As for missing features like some complex gradients, I can't say I've missed
them, except on occasion when dealing with shiny PR materials. Earlier
versions occasionally emitted blank pages, but these could always be skipped
thanks to a side effect of the PDF format.

PDF.js has an amazing future for such a young project, and it is _the_
foremost demonstration of exactly how complex programming tasks can be
expressed using native web technologies. Turns out 35kLOC of Javascript almost
completely subsumes the functionality of a behemoth native application (Adobe
Reader) that on some machines would require half a minute just to 'boot'.

While Mozilla are pumping out stellar designs like this, Google are pushing
crap like Native Client and their proprietary, binary-only Foxit Reader
solution instead, complete with the hundreds of thousands of LOC of insecure C
this entails. Rock on, Mozilla!

~~~
opinali
Please take your time machine and go release PDF.js in early 2010. With good
performance on the hardware and Javascript VMs of early 2010. _Then_ I'll
grant you the criticism of Chrome's PDF viewer. Otherwise, trolling... fact
is, Chrome is the browser that liberated the world from Acrobat Reader. PDF.js
is awesome and it may be the way to go, but as of today Chrome's viewer is
still much better -- please try <http://www.irs.gov/pub/irs-pdf/fw4.pdf> in
both browsers and tell me which one is sluggish and renders so-so, and which
renders/scrolls instantly and perfectly and also allows you to actually fill
the form.

~~~
Watabou
On the mac, Firefox Nightly loads the PDF in a second while Google Chrome Dev
loads in about three seconds. I can enter text in the pdf in Chrome while
Firefox gives an annoying little "The pdf might not be rendered perfectly"
error bar at the top.

Let's try Safari: Loads in under a second maybe even faster, super quick
scrolling, ability to enter text and the option to download the pdf on the
bottom. This is the way browsers should handle pdf. We are just not there yet.
I don't want to use Safari though. Firefox is the browser for me.

I almost always download the pdf anyways and view it through Preview.app,
especially if I want to actually input text in the pdf. I love Preview. It's
like the best PDF reader out there. Preview is what liberated me from Acrobat.
Well, switching to the Mac did that for me, really.

~~~
___1___
I don't have firefox and a pdf view won't change that. Your description of
Safari matches that of Chromium on Arch Linux.

~~~
Watabou
Does Chromium have a built in PDF reader? I thought google adds that in for
Chrome along with Flash?

~~~
natex
It is not included, but can be installed. (libpdf)

[https://wiki.archlinux.org/index.php/Chromium#Open_PDF_files...](https://wiki.archlinux.org/index.php/Chromium#Open_PDF_files_inside_Chromium)

------
twoodfin
If you want to try PDF.js from your current browser, here's a demo:

<http://mozilla.github.com/pdf.js/web/viewer.html>

I wonder what's keeping this so ugly in Chrome. Also, does anyone know if
printing is intended to work? It doesn't appear to have the pagination right,
again at least on Chrome.

~~~
duaneb
Looks much better than I imagined. Also painfully slow.

~~~
SteveMoody73
Most of the PDFs i read are electronics datasheets and they don't look half as
good and it also seems to be missing the bookmarks as well. Scrolling through
pages also seemed to take a long time.

I think i will have stick to adobe reader for now

------
soapdog
PDF.js rocks!

Now, stay tunned for ASM.js because that too will rock (once it is ready).

link: <http://asmjs.org/>

------
aviraldg
Love it, but unlike Chrome's embedded PDF reader, it can't "stream" PDFs (a
dealbreaker for people viewing media-heavy PDFs on slower connections)

~~~
baudehlo
That's interesting, because PDFs are an inherently un-streamable format. It
requires seeking within the file to work (hence why command line PDF tools
can't take STDIN for the PDF file - or they fake it by copying to a temp file
first).

I wonder how google got around that problem.

~~~
jevinskie
You could try to progressively render the file, pausing when a required
forward reference isn't within the data you have downloaded so far.

~~~
jammmuel
That seems to be what they do, in my experience.

------
johansch
It fails with the 4th google hit for "sample pdf":

<http://www.inkwelleditorial.com/pdfSample.pdf>

(The main difference I see with Firefox 19 on win7 is that it loads pages
significantly faster.)

~~~
chaud
Seems to render fine for me in FF20 on W7: <http://i.imgur.com/G5PPEbN.jpg>

------
eumenides1
Dumb question: What's to stop Chrome from eventually adopting PDF.js?

Personally, I see that as the future. Its open source, its "good enough", and
Google doesn't have to license the pdf viewer anymore.

Also it's a big coup against Adobe, when everyone with firefox and chrome can
pretty much uninstall your Adobe Reader software. I haven't even mentioned
shrinking the market on 3rd party PDF viewers.

~~~
nephyrin
Nothing!

pdf.js is already a part of the Octane benchmark and works well in chrome:

<http://mozilla.github.com/pdf.js/web/viewer.html>

Mozilla is about moving the web forward, not just beating the other guy, so I
don't imagine there'd be any gripe with Google picking up pdf.js in chrome.

------
kunai
Before this patch, this is usually how I would open PDFs in Firefox:

"Okay, so I clicked on the link. Wait - where's the Download box? No, wait --
I told Firefox to download this MIME type automatically, right? Okay, but
where is Evince? I thought it would load after I downloaded it. Okay, let me
cd to Downloads, it's probably there. Okay, now I have to open Evince -- no,
wait, I can just open Thunar to open it because the .pdf MIME is associated
with Evince. Okay, so now I have to launch Thunar... Okay, now where is my
Downloads folder again?"

Granted, it would be easier if I weren't such a blockhead, but it's still a
royal pain in the ass.

------
shmerl
It's nice to have such an option, but it feels significantly less snappy than
Kparts plugin in KDE which wraps Okular into Firefox.

~~~
CamperBob2
True, as with plain Adobe Reader. I spend a large part of my day reading
.PDFs, both in and out of my browser, and Firefox became a much less effective
"power tool" when they took the liberty of disabling the Reader plugin. I
couldn't care less how long it takes to _load_ a .PDF -- snappy rendering and
navigation is everything, and you don't get that from JavaScript.

It took a surprising (to me) amount of hacking to re-enable native .PDF
rendering. As far as I'm concerned, pdf.js is one of those increasingly-common
cases where Mozilla has unilaterally decided that it knows Just What I Need,
and followed up by attempting to impose it without offering me a choice.

~~~
Spittie
I don't know what you did, but i can easily change that by changing the
default action for PDF files in preferences -> Applications.

I've been using PDF.js myself for i think a year now (Used to install it
directly from their Github page), and it's a great reader if you aren't an
heavy PDF user. I barely have to open a PDF, and when i do it's usually just
text and images, not any fancy stuff. And i guess most computer users are just
like me. If you open PDFs all day, and are a power user, i guess that nothing
can replace a good standalone reader.

It's still kinda slow, but it has done some incredible progresses in the year
i've been using it. And i'm sure it will just get better and better.

------
homer-simpson
What I don't understand is why Google doesn't have an open source PDF viewer?
I mean, Chromium renders OpenGL, decodes movies, contains fastest JavaScript
VM and it cannot view PDFs? Given what they did to JavaScript speed, can you
imagine what viewer they would be capable of producing of? At least they
should join Mozilla on improving pdf.js, IMO...

~~~
mccr8
Chrome already has its own PDF viewer, presumably implemented in C or C++ or
whatever, so they probably don't care about making it available for Chromium.
Perhaps they bought the rights to the source code they based it on, and are
unable to open source it.

~~~
joshmoz
Google pays to ship FoxIt's closed-source PDF engine with Chrome.

------
Create
...and it displays your visited sites in a grand panorama on the canvas in a
new tab, despite having asked for always private browsing.

It could be a regression of both the browser, and the unit test, which isn't
such a good news.

~~~
nephyrin
If this is the case for you please file a bug - a lot of private browsing
changes have been occurring under the hood in preparation for proper per-
window private browsing in FF21, so it's very possible a regression snuck in
:(

------
brudgers
I've been using it for about a month. It's my default PDF viewer, on my
desktop - though sometimes it has choked on a file, and search has been an
issue on large files.

Generally though, it's a good solution that doesn't require dealing with Adobe
updates all the time.

------
AshleysBrain
Is this based on pdf.js? I couldn't seem to find out quickly. If so, very
cool!

Edit: I was being lazy, it definitely is. Very nice that it's plugin-free and
a pure HTML5 solution.

------
Aissen
I've been using it for while (it shipped before but wasn't enabled by default;
which I did). It works great most of the time, and is hassle-free. It's also
likely safer to use.

Now, if only Gmail would let me preview attachments in it. They do it for
Chrome's plugin. I tried messing with the URL arguments, but it seems the
Gmail server won't even give you the inline (ie not a download) version of the
PDF if your browser doesn't pretent to be Chrome.

------
stcredzero
I would love to have a PDF viewer app for OS X based on PDF.js. Better still
if it could be sandboxed and have other enhanced security.

Just tried out Firefox 19, and the PDF reader is good. Responsive enough, with
just the barest hint of render lag. Minor nit: Firefox isn't currently
registered as handling PDF, but will still open it happily.

EDIT: I have Firefox as my OS X Mountain Lion's PDF viewer app now. Works
quite well!

~~~
jonknee
Any particular reason? OS X natively supports PDFs (and is both much faster
and more complete than pdf.js).

~~~
stcredzero
Preview has had a history of security holes. PDF.js would at least be immune
to buffer overflow exploits.

------
gmac
I've been using this for a while in Firefox beta, and it's generally really
good.

I have two small problems with it, which perhaps won't be too hard to fix:

1\. PDFs of old academic papers that are just strung-together CCITT (fax)
compressed monochrome scans. Preview.app, Adobe Reader and Chrome resample
those to give a readable quasi-anti-aliased effect. PDF.js makes the text
jaggy and spindly and hard to read.

2\. No back/forward navigation.

------
ozten
I've been enjoying Pdf.js for months, as I use Aurora as my main browser.
Aurora[1] is the the first step before Firefox Beta.

If you want to use awesome features like pdf.js earlier... get on Aurora. It
has been surprisingly stable channel for pre-beta code.

[1] <http://www.mozilla.org/en-US/firefox/aurora/>

------
Nux
Impressive piece of Javascript, but it's quite heavy on my CPU. I will
continue using Evince for the time being.

------
hoodoof
We have a major in house application that displays PDF files as a core part of
its functionality.

The Firefox PDF reader is very slow compared to Chrome's.

Also, the second and subsequent PDF files you click on do not commence the
display at the top of the page, the appear to commence display somewhere down
the page, I'm guessing maybe at the position that the previous PDF scrolled
to. So immediately you need to pull the scrollbar back to the top before you
can start reading the PDF.

So for now, just on speed alone we'll pass on the Firefox PDF reader.

------
skinnynerd
This is really amazing, but I wish these two browsers would be pushing for a
FOSS version of PDF instead.

I do not think openXPS is entirely FOSS but it is a good place to start
looking for an alternative.

Here is an xps file on the web to see how your browser handles it:
<http://www.rosebudschooldist.com/images/Feb%20Cal%202013.xps>

------
Aardwolf
Thanks for doing this, but it is not working well for me! It takes way longer
to load than a normal PDF viewer, is slow, and basically I gave up and closed
it when pages were still black, or white, with a rotating loading indicator,
minutes after a regular PDF viewer already showed it. This in Linux.

Thanks!

------
forgetcolor
just tried it on a large PDF. Chrome takes about 1 second to load while FF
takes 10, and the visual result in FF is nearly unreadable (while in Chrome it
looks just like it does in Acrobat). i'd love to have nice open-source native
PDF support, but this surely doesn't cut it for release.

------
arthurrr
If this is the future of computing, then I quit. I don't want to play anymore.

------
iyulaev
Interesting. I was wondering why I had to re-enable FoxIt viewer after the
latest Firefox update. Maybe it works well for some PDFs, but the first two I
happened to open were formatted pretty badly.

------
klrr
What, this is not what a web browser is supposed to do.

~~~
nine_k
How about web browsers showing you graphics? Animated graphics? Videos? 3D
graphics?

~~~
klrr
Not locally.

------
magg
how is pdf.js gonna be updated in firefox... i was using the dev version add-
on of pdf.js and seems to work better than the one shipped in FF19

------
curiousdannii
Don't miss the announcement that Firefox for Android now supports ARMv6! Many
~$100 Android phones now have the option of a better browser!

------
ww520
As a pure Javascript solution, it can run on a wide variety of platforms, as
far as the browsers are running.

------
unix-dude
Works well, looks sleek, and only randomly locked up once (To be fair, I had
tons of tabs open).

Good job!

------
mariusmg
Is there anyway to change the background/foreground color ?

------
av500
what happened to doing one thing and doing that well? what is next, office
documents?

~~~
icebraining
It does only one thing. Firefox doesn't depend on PDF.js and vice-versa,
they're just bundled together.

------
ucpete
Serious question: what took so long?!

~~~
biot
Perhaps they gave up waiting for your implementation.

------
green_fox
The experience on Android phones is solid but this core feature is really late
to the game.

I love firefox but cant keep using a browser thats always playing catch-up

~~~
datr
I really like Chrome and use it when developing just for webkit inspector but
I can't switch to it for regular browsing as I still feel like Chrome can't
match the browsing experience of FF. For example:

Tab Management

In firefox I can much more easily have dozens of tags without them all
becoming squished. Instead I get scroll bars and a drop down menu.

With tab mix plus, tabs which I haven't read yet are highlighted.

I also have a close tabs to the left option in the context menu (which I
really love).

Adverts

Adblock in firefox seems to be much more stable than the chrome alternative
and just does a better job generally of blocking adverts. (This one might be
solved by the likes of privoxy but then I lose the tight integration with the
browser.)

Password Management

I'm a regular user of last pass but in chrome it can't integrate with the http
auth dialog which means I'm forced to open up my vault and copy and paste my
credential manually which is a huge hassle.

I really like Chrome and I'd love to use it all the time but these things (and
a few others) prevent me from doing so. Does anyone know if there are any
chrome extensions which address these issues?

~~~
robin_reala
Re: your LastPass Chrome problem, you need to install the extension with a
binary component (there are two on LastPass's site)

------
stuff4ben
Why is this news except the fact that Chrome has had this for years? Was Adobe
paying Mozilla in the same way that Google paid them for the search bar
preference?

~~~
joshmoz
Adobe was not paying Mozilla for anything like that. Chrome simply includes a
paid closed-source product (FoxIt, iirc). This was and is not an option for
Mozilla for multiple reasons.

It took Mozilla a while to get here, which is unfortunate, but the result is
an open-source PDF reader that doesn't add yet another binary rendering engine
to the browser (think security, hack-ability). Creating it made Gecko and the
web platform better, because it pushed us. There is more work to do, but it's
a great start and a welcome change to how these features are implemented.

A bit more info in a blog post that I wrote:

[https://boomswaggerboom.wordpress.com/2013/02/19/exciting-
st...](https://boomswaggerboom.wordpress.com/2013/02/19/exciting-stuff-
firefox-19s-built-in-pdf-reader/)

~~~
Ygg2
Interestingly, there are also a prototype Flash in JavaScript called Shumway:
<https://github.com/mozilla/shumway>

And an IIUC a DOM renderer in JS <https://github.com/andreasgal/dom.js/>

I don't know if PDF.js will ever reach full PDF compatibility (with all it's
weird forms and other stuff), but I do hope so. With a liberal licence I can
totally see people embedding pdf.js to render their pdfs on site.

