从HTML5存储打开PDF [英] Open PDF from HTML5 Storage

查看:163
本文介绍了从HTML5存储打开PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将pdf文件客户端存储在HTML5存储(indexedDB或localstorage)之一中,然后用adobe reader将其打开。

如下所示:


  1. 用户访问我的站点,并将一堆pdf下载到存储中

  2. 后来用户重新访问该站点,并希望查看其中一个预先下载的PDF文件。

    他选择一个存储的PDF文件,并使用adobe阅读器(或
    默认pdf渲染器) 。

这是纯html5 / js的可能吗?还是必须写一个firefox扩展?


您可以使用数据URI方案

解决方案

http://en.wikipedia.org/wiki/Data_URI_scheme )。



类似这样的,但带有PDF:

  data:image / png; base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0 AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKBJREFUeNpiYBjpgBFd4P /// wJAaj0QO9DEQiAg5ID9tLIcmwMYsDgABhqoaTHMUHRxpsGYBv5TGqTIZsDkYWLo6gc8BEYdMOqAUQeMOoAqDgAWcgZAfB9EU63SIAGALH8PZb + H8v + jVz64KiOK6wIg + ADEArj4hOoCajiAqMpqtDIadcCoA0YdQIoDDtCqQ4KtBY3NAYG0csQowAYAAgwAgSqbls5coPEAAAAASUVORK5CYII = 

可以在其原始页面查看此示例: http://iconhandbook.co.uk/reference/examples/data/


I want to store pdf files client side in one of the HTML5 storages (indexedDB or localstorage) and then open them later with the adobe reader.

The scenario is as follows:

  1. The user visites my site and downloads a bunch of pdf's into a storage
  2. Later the user revisits the site and wants to view one of the pre downloaded pdf's.
    He chooses one of the stored pdf's and it gets rendered with the adobe reader (or the default pdf renderer).

Is this possible with pure html5/js or do i have to write a firefox extension?

解决方案

You can use the data URI scheme (http://en.wikipedia.org/wiki/Data_URI_scheme).

Something like this, but with a PDF:

data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAKBJREFUeNpiYBjpgBFd4P///wJAaj0QO9DEQiAg5ID9tLIcmwMYsDgABhqoaTHMUHRxpsGYBv5TGqTIZsDkYWLo6gc8BEYdMOqAUQeMOoAqDgAWcgZAfB9EU63SIAGALH8PZb+H8v+jVz64KiOK6wIg+ADEArj4hOoCajiAqMpqtDIadcCoA0YdQIoDDtCqQ4KtBY3NAYG0csQowAYAAgwAgSqbls5coPEAAAAASUVORK5CYII=

You can see this example at its original page: http://iconhandbook.co.uk/reference/examples/data/

这篇关于从HTML5存储打开PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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