

Google's Javascript PDF Viewer is Embeddable - blasdel
http://googlesystem.blogspot.com/2009/09/embeddable-google-document-viewer.html

======
makmanalp
For HN as an alternative to scribd's vaccuum maybe?

~~~
axod
scrolling/zooming even works! die flash, just die.

~~~
mooted
Text copy wont work.

I really dont see anything new here. This is exactly the same stuff they have
at Google books. Except now its in an iframe .

Flash implementations are obviously superior as of now.Also, try building a
decent browser game in javascript and html5.

~~~
chaosprophet
Actually games that don't involve too much motion tweening (think sudoku, tic
tac toe etc.) can be done pretty well with js and html5.

~~~
mooted
any live examples?

~~~
mikeryan
This is old but this version of arakanoid was always pretty impressive.

<http://www.schillmania.com/arkanoid/>

Note it does cheat and use flash for SFX

------
blasdel
It also works as its own page: <http://docs.google.com/gview?url=>

Does anyone know if firefox extensions can register as handlers for MIME
types, or if they're restricted to diddling with chrome / pre-existing pages?
It'd be really easy to write a WebKit plugin to do it, but not very useful
since Safari ships with a flawless PDFKit-based viewer.

I want to get this working in Firefox, but NPAPI plugins are really gross. It
looks doable that way, as it appears that a naked nsplugin still gets a DOM
and everything, so I could just immediately set window.location.href and be
done with it.

~~~
thristian
It sounds like you're looking for window.navigator.registerContentHandler:

    
    
        https://developer.mozilla.org/en/DOM/window.navigator.registerContentHandler
    

...except a website can only register themselves as a content-handler. You
could probably hack up a bookmarklet to do it, if you can't find an XSS
vector, but I can't seem to make it work myself.

~~~
blasdel
So... close...

It'd be easy to make a greasemonkey-style extension that calls this on *, but
it wouldn't work for links to other domains (which I'd bet are the majority of
PDF links)

~~~
jacquesm
That would already be very useful though, for things like online papers and
datasheets, which as a rule sit on the same server as the page you're looking
at.

~~~
legooolas
It's becoming more common to use a separate domain for static content like
this to be cached more effectively (and to have no cookies etc sent), so it
may not always be the same server as the page you're looking at.

------
stjarnljuset
It's good to know that there are alternative ways to embed PDFs, but I'm a
little confused by the reaction in the comments. Is this a big improvement
over simply using the object tag?

<http://blog.flashcolony.com/?p=244>

~~~
blasdel
Yes, for a wide variety of reasons:

    
    
      * Before version 8, Adobe's plugin was an epic piece of shit on all platforms
         - old versions are on hundreds of millions of computers!
         - it's still really crashy on Linux (especially in nspluginwrapper)
         - The only OS X browser they support is Safari, in which it is unnecessary
      * Google re-hosts the file for you
      * It is ridiculously snappy with no main-thread-blocking initialization
      * It will never crash your browser
      * Your users don't have an ingrained hatred towards it
          - Rebranding the free Acrobat as "Adobe Reader" was the stupidest thing
            they've ever done (ever hear a user say 'my Adobe is broken'?)

~~~
seiji
I can't tell if you're being facetious in your last line, but I used to work
at a place requiring, in their own words, "Adobe must be installed on every
computer" long before they changed the Acrobat name.

------
ars
It's images! Is that really better?

It's not text layed (laid?) out in a cool way with HTML.

It's a png image of each page of the pdf. It's quick sure, but images? Not
text? It just seems wrong - why even make pdf's, if all you want is an image
of the text?

~~~
btn
Generating an image from the PDF server-side is the only way to faithfully
perserve the layout of the PDF.

For some PDFs, Google will give you the option to view it as HTML (it seems to
just be the PDFs returned in search results?). It's usable for mostly-text
documents, but that's about it.

------
Maro
I hope somebody makes a Firefox addon which lets me right-click on a PDF link
and select "Preview" using the Google previewer.

~~~
Maro
There's this, but it sucks:

<https://addons.mozilla.org/en-US/firefox/addon/10737>

You click a link and it first does some communicatin with Google Docs to get
some kind of security token, so it takes 2-3 seconds for the new tab to come
up.

EDIT:

A kickass version, just uploaded it to the Firefox Addons site:

<https://addons.mozilla.org/en-US/firefox/addon/14226/>

~~~
blasdel
I think that addon is worse than you describe: doesn't it add the files to
your logged-in Google Docs account, and do so by uploading said files from
localhost?

~~~
Maro
You're right, I just checked my Google Docs and it added the files. The hacked
version just opens the URL and passes in the PDF url as a HTTP param.

~~~
pasbesoin
You mean the second link in your granparent post, right? Thanks for that --
works for me. I was looking for something like this just the other day.

------
tolmasky
This is very cool. My only gripe is that if they are going to fake their own
selection, then they should override command-a (select all). I tried this, and
now I have google's selection AND the entire page selection, which I can't get
rid of.

------
Chmiff
I hope that it will be extended to TeX, PostScript and ODF as well.

The viewers for the first two formats are lagging in the UI department, it
would be really nice to be able to access them online.

------
joubert
I presume one can't use this viewer in your own project (e.g. as a file viewer
in a web app).

Does anybody know of similar project but that can be used in your own web app?

~~~
patio11
Quick Googling suggests that <http://vuzit.com/> would work.

You might also be able to hack Thindoc in such a way that it worked for your
purpose.

~~~
furyg3
Don't know why you're downmodded.

I use <http://www.ajaxdocumentviewer.com/> on my own personal site. It works
the same way as Google (but has ads), and handles .doc files.

I'd much rather use the Google app if it could handle .docs :(

------
est
I wish their Chat Window on Google Spreadsheet were embeddable , too.

------
stef25
Scribd must love this

------
ComputerGuru
Do you think the same thing exists for Word documents?

------
jbrun
Can anyone confirm if this works in Internet Explorer?

~~~
fauigerzigerk
It does. Even current versions of IE can show PNGs in iframes, believe it or
not ;-)

------
ntoshev
Very smooth, but why does it lack a search box?

~~~
ZeroGravitas
The full page version has a (pretty good) search function. I'm not sure why
they don't have it the embedded one. Even if you just got taken to the results
in the full version.

~~~
ntoshev
ACtually the full page version highlights the results but doesn't navigate to
them. Also it seems to be substring search, not an indexed one.

------
_ck_
Here is a bookmarklet I just wrote to look at all the links on a page and open
any ending in ".pdf" in google's viewer. (if you have firefox set to open tabs
for windows, it will open them in new tabs) Feel free to share and improve.

\- - - (select entire text and make into a link) \- - -

    
    
      javascript:(function(){dl=document.links;for(i=0;i<dl.length;++i){if(dl[i].href.substr(-4)==".pdf"){window.open("http://docs.google.com/gview?embedded=true&url="+dl[i].href);}}})()
    
    

\- - -

~~~
chaosprophet
I made this into a greasemonkey userscript. It searches for PDF links on a
page and sets them to open in Google's pdf viewer.

Userscript at: <http://userscripts.org/scripts/show/57453>

Tested on Minefield latest nightly, winxp, greasemonkey.

~~~
parterburn
Thanks! It needs to not work on <http://docs.google.com> so that you can click
the "Download" link if you need to...otherwise you are stuck in a loop. Also,
I noticed that the search on the full-screen page isn't always available (ie
<http://bit.ly/4tf1xt>)

~~~
chaosprophet
About the search not being available, I think it's something to do with
google's implementation, not the script. The other, I'll fix ASAP.

Edit: Fixed version available now.

