Open aalexei opened 10 months ago
Hello, is the code processed by a template engine? I'm asking because of the string '/file/{{fuid}}.djvu'
.
Try to hardcode the URL and try to open another file.
Same error, and I've checked it all get's expanded correctly and there is a file at that url.
The following variant works, but requires loading data into array buffer:
async function loadDocument1() {
// Working
const viewer = new DjVu.Viewer();
viewer.render(document.getElementById('djvu-view'));
const indexFileBuffer = await fetch('/file/{{fuid}}').then(r => r.arrayBuffer());
await viewer.loadDocument(indexFileBuffer);
}
async function loadDocument2() {
// Not working
const viewer = new DjVu.Viewer();
viewer.render(document.getElementById('djvu-view'));
await viewer.loadDocumentByUrl('/file/{{fuid}}');
}
loadDocument1();
So seems to be something with the parsing of the url?
Please, check the browser console (Ctrl+Shift+I). I need more information. And is it a bundled (single file) document or an indirect (multifile) one?
This is using the js files from https://djvu.js.org/downloads (DjVu.js 0.5.4, DjVu.js Viewer 0.10.0).
Console reports
TypeError: invalid type format
at DE (djvu_viewer.js:134:4404)
at Op.loadDocumentByUrl (djvu_viewer.js:134:17798)
at loadDocumentByUrl.next (<anonymous>)
at h (djvu_viewer.js:134:1351)
at E (djvu_viewer.js:134:1910)
errorAction @ djvu_viewer.js:78
loadDocumentByUrl @ djvu_viewer.js:134
h @ djvu_viewer.js:134
E @ djvu_viewer.js:134
Promise.then (async)
bc @ djvu_viewer.js:131
v @ djvu_viewer.js:134
y @ djvu_viewer.js:134
h @ djvu_viewer.js:134
E @ djvu_viewer.js:134
(anonymous) @ djvu_viewer.js:131
YC @ djvu_viewer.js:131
Qg @ djvu_viewer.js:131
Gg @ djvu_viewer.js:131
Xg.e.put @ djvu_viewer.js:131
(anonymous) @ djvu_viewer.js:134
(anonymous) @ djvu_viewer.js:131
(anonymous) @ djvu_viewer.js:134
loadDocumentByUrl @ djvu_viewer.js:134
loadDocument2 @ UGMDGMH1C25FXGNTWGI1UVEHY:160
(anonymous) @ UGMDGMH1C25FXGNTWGI1UVEHY:162
I forgot about this issue. Sorry for that. If you still need it to be solved, please, send me the file. Or at least tell me its type (bundled or indirect) and the final URL that is used to load it.
Hi, I'm trying to set up a viewer for djvu files I serve on a local url line
/file/uid.djvu
. Using the codebut I just get the error:
What am I doing wrong?