简体   繁体   English

.pdf 的离线可用性同时使用 PDF.js

[英]Offline availability of .pdf while using PDF.js

My problem is the following:我的问题如下:

I use PDF.js to display a .pdf on a website.我使用PDF.js在网站上显示.pdf However the .pdf must be included from some url .但是.pdf必须包含在某些url中。 That means, that if one downloads the website for offline purposes, the .pdf will not be included and therefore can not be displayed.这意味着,如果出于离线目的下载该网站, .pdf将不包括在内,因此无法显示。 Thus I wonder, whether it is possible to embed the .pdf (eg in an html -container), so that it can be found by PDF.js .因此我想知道,是否可以嵌入.pdf (例如在html容器中),以便可以通过PDF.js找到它。 In this case, offline mode would be easy to achieve.在这种情况下,离线模式很容易实现。

You can load the file into memory and then use URL.createObjectURL() to create an URL for that object您可以将文件加载到 memory 中,然后使用URL.createObjectURL()为该 ZA89AC6BDE863 创建一个 URL54626BDE863

I think this can't be achieved without using a localhost (or a browser plugin etc.).我认为如果不使用本地主机(或浏览器插件等),这是无法实现的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM