2009年09月25日 16:00 [Edit]

#google - Docs Viewer、いけるじゃん

logo

早速試してみました。

「Google Docs Viewer」で、PDFなどブログへ埋め込み表示可能に -INTERNET Watch
米Googleは24日、「Google Docs Viewer」を使って、PDFやPowerPoint、TIFFドキュメントをブログやWebサイトへ埋め込み表示する機能の提供を開始したと発表した。

といっても、手頃なPDFがとっさに思いつかなかったので、これを。

iframeによる埋め込みにも対応しています。PDFのロードが思いかも知れないので低速回線/低解像度ブラウザーをお使いの方は注意(ということでJSでやってます。IE未検証:)

以下、上の応用でJSビューワーローダーも用意してみました。

DHTMLのソースは以下のとおりです。

<input type="text" size="64" value="http://www.dpj.or.jp/special/manifesto2009/pdf/manifesto_2009.pdf"
><input type="submit" value="View" onclick="(function(e){
  var iframe = document.getElementById('googledocsviewer');
  iframe.width  = 600;
  iframe.height = 780;
  iframe.style.display = 'block';
  iframe.src = 'http://docs.google.com/viewer?url='
    + encodeURIComponent(e.previousSibling.value)
    + '&embedded=true';
})(this);
"><input type="submit" value="Hide" onclick="
  document.getElementById('googledocsviewer').style.display = 'none';
">
<div><iframe id="googledocsviewer" style="display:none"></iframe></div>

一つ感心したのは、Viewerがきちんとテキストを認識していること。ちゃんとコピペもできます。

Enjoy!

Dan the Man with Too Many PDFs Link to Follow Reluctantly


この記事へのトラックバックURL

この記事へのコメント
ロードが思いかも→ロードが重いかも
Posted by typo at 2009年09月25日 18:41
少なくともWinXP&IE8ではビューアーもビューアーローダーも動いてます。
Posted by 地元密着なび・シンタニ at 2009年09月25日 20:19