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)
If you are using .net core (2.1) try to add .properties as static file in your "public void Configure(IApplicationBuilder app, IHostingEnvironment env)" method
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".properties"] = "application/octet-stream";
app.UseSpaStaticFiles(new StaticFileOptions
{
ContentTypeProvider = provider
});
Inspired by Lukáš Janeček, If you are using .net core(3.1). try to add the following code to your public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
var provider = new FileExtensionContentTypeProvider();
provider.Mappings[".properties"] = "application/octet-stream";
app.UseStaticFiles(new StaticFileOptions()
{
ContentTypeProvider = provider
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With