Which product are you using? PDF.js Express Viewer
PDF.js Express Version 8.7.4
Detailed description of issue
When I attempt to load a document src, the viewer prefixes the path with the lib files path and I get a popup that says “Missing PDF [domain][pdfjs-express-viewer lib file path][document src path]”
This error is happening with and without the ‘options’ parameter in loadDocument(). I’ve also tried ‘instance.UI.loadDocument’
I’m using vue js 3.2.40
Expected behaviour
I’m expecting the pdf viewer to load the document file path without adding the lib file path in the middle
Does your issue happen with every document, or just one?
Every document
Code snippet
<template>
<div ref="viewer"></div>
</template>
<script>
/* eslint-disable */
import WebViewer from "@pdftron/pdfjs-express-viewer";
import {onMounted, ref, watch} from "vue"
import {publicPath} from "../../vue.config";
export default {
name: "WebViewer",
props: {
src: String,
},
emits: ['done-loading', 'update-loading'],
setup(props, {emit}) {
let viewer = ref(null)
onMounted(() => {
WebViewer(
{
path: publicPath + "lib", // viewer files path
initialDoc: props.src || '',
licenseKey: 'redacted',
},
viewer.value
).then((instance) => {
// now you can access APIs through the WebViewer instance
const {Core} = instance;
watch(() => props.src, () => {
instance.loadDocument(props.src, {
onLoadingProgress: percent => {
emit('update-loading', percent * 100)
},
loadAsPDF: true
})
})
Core.documentViewer.addEventListener('documentLoaded', () => {
emit('done-loading')
// must be set after document loads
instance.setLayoutMode(instance.LayoutMode.Continuous)
});
});
})
return {
viewer
}
}
};
</script>