0
votes

I'm having issues using the instance.loadDocument(), to point the path where my pdf are located. If I'm using the initial document path inside WebViewer constructor, everything loads fine.

 useEffect(() => {
    WebViewer(
      {
        path: 'lib',
        initialDoc: `lib/pdf/mydoc.pdf`,
      },
      viewer.current
    ).then((instance) => {

When I try to load an instance instead, I try to point to the same path but I'm getting the error: "Pdf header not found"

.then((instance) => {
      const { docViewer, Annotations } = instance;
      instance.loadDocument(`lib/pdf/mydoc.pdf`)
      const annotManager = docViewer.getAnnotationManager();

How Shall I use this loadDocument function there? Or if I might something else maybe. Thanks for the help!

1

1 Answers

0
votes

Can you open "lib/pdf/mydoc.pdf" in a web browser? Is it accessible from a URL?