找不到“locale.properties";来自 PDF.js 的文件 [英] Can not find "locale.properties" file from PDF.js

查看:80
本文介绍了找不到“locale.properties";来自 PDF.js 的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用这个插件:

而且我也收到了很多来自 l10n.js 的警告.我在这里下载:

这是所有 l10n.js 错误消失的控制台日志视图:

使用application/octet-stream的原因是对应的文件应该被当作流处理,即使是文件内容也是可读的并且以文本格式存储.

参考:l10n.js - locale.properties 404(未找到)

I use this plugin: PDF.js.

I am trying to solve the problems that show in console log.

Follow image:

Here is a simple project ready, only download and run project you will see the same problem. I've tried everything and I can not solve a problem.

Follow html:

<div style="width: 800px; height: 500px;">
    <iframe width="800" height="500" id="iframePdfViewer" seamless="seamless" scrolling="no" src="~/Scripts/pdfjs-dist/web/viewer.html"></iframe>
</div>

See another image that contains "locale.properties" file:

And I also get a lot of warnings from l10n.js. I downloaded it here: http://mozilla.github.io/pdf.js/ by clicking the "download" button.

Any solution ?

解决方案

Adding .properties MIME type configuration inside web.config file should work:

<configuration>
  <!-- other stuff -->

  <system.webServer>
     <staticContent>
        <mimeMap fileExtension=".properties" mimeType="application/octet-stream" />
     </staticContent>
  </system.webServer>
</configuration>

If the project is already deployed in IIS (not IIS Express), go to site name => MIME Types => Add, and set .properties extension with application/octet-stream type as in provided image below:

Here is the console log view with all l10n.js errors disappear:

The reason behind usage of application/octet-stream is that the corresponding file should be treated as stream, even file contents are readable and stored in text format.

Reference: l10n.js - locale.properties 404 (Not Found)

这篇关于找不到“locale.properties";来自 PDF.js 的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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