You may or may not see an error message at webviewer initialDoc API error

WebViewer Version:
@pdftron/webviewer”: “^8.7.0”,

Do you have an issue with a specific file(s)?
yes.

Can you reproduce using one of our samples or online demos?
No.
Requires server-side customization.
(download url 500 error response)

Are you using the WebViewer server?
No.

Does the issue only happen on certain browsers?
No.

Is your issue related to a front-end framework?
No.

Is your issue related to annotations?
No.

Please give a brief summary of your issue:
(Think of this as an email subject)
you may or may not see an error message at webviewer initialDoc API error.

Please describe your issue and provide steps to reproduce it:
(The more descriptive your answer, the faster we are able to help you)

When you get a 500 error response at downloadUrlApi, you may or may not see an error message.

      WebViewer(
        {
          path: Path,
          fullAPI: true,
          enableRedaction: false,
          licenseKey: LicenseKey,
          initialDoc: downloadUrlApi,
        },

If you see an error

if no error is displayed

OfficeWorker.js can display errors.
PdfWorker.js can’t display errors ?

Best Regards.

Please provide a link to a minimal sample where the issue is reproducible:
nothing.

Hello,

Thank you for contacting us about WebViewer. Since the error is a 500, internal server error, the issue could be with WebViewer being unable to load the document you provided as “initialDoc”. For debugging this I would

  1. Check if setting “initalDoc” to “https://pdftron.s3.amazonaws.com/downloads/pl/demo-annotated.pdf” works. Mainly a basic test to make sure WebViewer is working in your project

  2. Check if the “downloadUrlApi” URL is accessible. Can try entering it into a browser to check if it’s working

  3. Instead of using “initalDoc”, use “fetch” and “loadDocument” to load the document. Can see the following link for an example
    Apryse Documentation | Documentation
    PDFTron WebViewer Namespace: UI

Depending on your server setup, there could be issues with “fetch” not being able to access the “downloadUrlApi” URL being used. You could be missing headers or filename needed for WebViewer to load the document. You can find out more in the link below

Please let me know if the above helps or if you want me to clarify something

Best Regards,
Andrew Yip
Web Developer
Apryse

Hello,

Thank you for your replay.

What I want to point out is that in some cases the error dialog does not appear.
Why is the error dialog not displayed in some cases?

Best Regards.

Hello,

It looks like WebViewer sometime is having issues accessing files at the “downloadUrlApi” URL you are providing it. This could be due to a number of reasons

  • server is overloaded and unreachable
  • error in the server side code and it’s not providing response
    • could be an issue with already in used document
  • session data expired and authentication not working
  • bad cookie data

Not being able to access the server make this a bit hard for me to debug but there a good chance the issue is on the server side. If you are able to, accessing the server logs might give you more information about why these error occurs.

Best Regards,
Andrew Yip
Web Developer
Apryse