Google文档PDF查看器如何工作? [英] How does the Google Docs PDF viewer work?

查看:153
本文介绍了Google文档PDF查看器如何工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很想知道Google Docs PDF查看器的工作原理吗?这不是像scribd.com这样的闪光点;它看起来像纯HTML.知道他们是怎么做到的吗?

I am curious to know how the Google Docs PDF viewer works? It's not a flash like scribd.com; it looks like pure HTML. Any idea how do they did it?

查看PDF的示例链接

推荐答案

Google只是提供一张图片(右键单击->另存为),并用叠加层突出显示文本.

Google is simply serving up an an image (right click -> save as), with an overlay to highlight text.

您应该查看此SO问题其他细节.

您还应该查看PDF链接的来源,这似乎表明Google正在传递PDF链接,从而将其转换为图像.

You should also look through the source of your PDF link, it would appear Google are passing the PDF link through to be converted into an image.

示例:

<script type="text/javascript"> 
        var gviewElement = document.getElementById('gview');
        var config = {

          'api': false,
          'chrome': true,
          'csi': true,
          'ddUrl': "http://www.idfcmf.com/downloads/monthly_fund/2009/IDFC-Premier-Equityfund-jan10.pdf",
          'element': gviewElement,
          'embedded': false,
          'initialQuery': "",
          'oivUrl': "http://docs.google.com/viewer?url\x3dhttp%3A%2F%2Fwww.idfcmf.com%2Fdownloads%2Fmonthly_fund%2F2009%2FIDFC-Premier-Equityfund-jan10.pdf",
          'sdm': 200,
          'userAuthenticated': true
        };

        var gviewApp = _createGView(config);
        gviewApp.setProgress(50);


          window.jstiming.load.name = 'view';

          window.jstiming.load.tick('_dt');

      </script> 

修改

此外,如果您要在带Firebug的Firefox中查看PDF查看器,您会注意到,当突出显示"文本时,它实际上仅启用了div加载,我猜想Google会使用OCR扫描文档,并在何处检测到文本是,并提供一个坐标矩阵作为div放置的基础,当您单击并拖动它时,它会提示鼠标指针位置以确定要显示的div.

Also if you were to view the PDF viewer in Firefox with Firebug, you will notice that when you 'highlight' text it's really only enabling a load of divs, I'm guessing Google scans the document using OCR, detects where the text is and provides a matrix of coordinates on which to base the div placement on, when you click and drag it introgates the mouse pointer location to determine which divs to display.

这篇关于Google文档PDF查看器如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆