# loadDocument is adding lib file path to document src path

**URL:** <https://pdfjs.community/t/loaddocument-is-adding-lib-file-path-to-document-src-path/2746>\
**Category:** Technical Support\
**Created:** [July 24, 2023, 9:49pm UTC](https://pdfjs.community/t/loaddocument-is-adding-lib-file-path-to-document-src-path/2746 "2023-07-24T21:49:40Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![samiam](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@samiam](https://pdfjs.community/u/samiam)\
**Post date:** [July 24, 2023, 9:49pm UTC](https://pdfjs.community/t/loaddocument-is-adding-lib-file-path-to-document-src-path/2746/1 "2023-07-24T21:49:40Z")

</div>

**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**

```javascript
<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>

```

---

<div class="post-metadata">

**Author:** ![darian.chen](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@darian.chen](https://pdfjs.community/u/darian.chen)\
**Post date:** [July 25, 2023, 5:09pm UTC](https://pdfjs.community/t/loaddocument-is-adding-lib-file-path-to-document-src-path/2746/3 "2023-07-25T17:09:42Z")

</div>

Hello there,

Could you please provide the contents of your `vue.config` file as well?  
Thank you.

Best Regards,  
Darian Chen

---

<div class="post-metadata">

**Author:** ![samiam](https://avatars.discourse-cdn.com/v4/letter/s/7c8e57/32.png) [@samiam](https://pdfjs.community/u/samiam)\
**Post date:** [July 25, 2023, 5:25pm UTC](https://pdfjs.community/t/loaddocument-is-adding-lib-file-path-to-document-src-path/2746/4 "2023-07-25T17:25:46Z")

</div>

```javascript
module.exports = {
    runtimeCompiler: true,
    publicPath: process.env.NODE_ENV === 'production'
        ? '../dxc/'
        : '/dxc/',
    devServer: {
        proxy: {
            '^/api': {
                target: '[uat auth server link]',
            },
        }
    },
}

```

the project and all assets are served from the /dxc path

---

<div class="post-metadata">

**Author:** ![darian.chen](https://avatars.discourse-cdn.com/v4/letter/d/3d9bf3/32.png) [@darian.chen](https://pdfjs.community/u/darian.chen)\
**Post date:** [July 25, 2023, 7:16pm UTC](https://pdfjs.community/t/loaddocument-is-adding-lib-file-path-to-document-src-path/2746/5 "2023-07-25T19:16:15Z")

</div>

Hello there,

When you load the document, the API should be either `instance.UI.loadDocument` or `instance.Core.documentViewer.loadDocument`.

Thank you for providing the previous code snippets. However, we we unable to reproduce the issue regarding the missing PDF popup.

Could you please provide a minimal sample of your project and a screenshot/video of the error?

Thank you.

Best Regards,  
Darian Chen
