Error during fetch i18n files in Electron environment

PDF.js Express Version
8.0.0 / 8.1.0

Detailed description of issue

PDFJSDocumentType attempts a fetch with a url of type “file: //”. and fails (remember we are in Electron environment).

In web environment is all ok.

Expected behaviour
Webviewer load i18n translation.

Does your issue happen with every document, or just one?
Every time

Link to document
ND

Code snippet
Attached

image

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hey there,

Can you please share a code snippet showing how you are loading Express? What is your path parameter set as?

Thanks,
Logan

Sure, attached below

image

Hey there,

I am not too familiar with Electron so I don’t know how useful I will be here.

Can you try using a relative path like we do in our sample?

Thanks,
Logan

Hi Logan, thanks for your reply.

No, the relative path is not the solution. The problem is PDFJSDocumentType try to get i18n json files with a Fetch API call. Fetch API can’t get file with file:// protocol. Here is any workaround for load i18n json in WebViewer manually?

P.s the problem is in v7 and v8, v6 not use Fetch api.

Hey there!

I just found out we actually just merged a pull request that changes how these files are loaded. This will be pushed in the next release (which I will make next week). Keep an eye out in #announcements .

Thanks,
Logan

Thanks, i’ve solved with a upgraded version of Electron.

Now i’ve the same problem with cordova…i really think you need to change how these files are loaded :slight_smile:
Thanks a lot!

Yup! The incoming fix will fix Cordova as well (thats what the fix originally was for)

Logan

Ok Logan, if the new release solve the Cordova issue it will be nice :slight_smile:

I attach a screen (label are not translated).

1 Like

Hi Logan, any update for the fixed release?

Hey there,

We will be releasing this week. Just waiting for a couple more fixes to get through code review.

Thanks,
Logan