"Missing PDF" when testing app in browser

Posted by: blake on 16 August 2020, 11:00 am EST

    • Post Options:
    • Link

    Posted 16 August 2020, 11:00 am EST

    I recently downloaded an unlicensed PDF Viewer through NPM (and even tried using the ZIP). Everything seems to be working, except it won’t actually load the PDF.

    The PDF and javascript are currently in the same folder as my index.html, but every time I test the code in Chrome (and even tried Edge), an error that states “Missing PDF” pops up, and I’m not sure what to do to get it to actually load my PDF.

    I’ve followed the documentation pretty thoroughly, but to no avail, using the following resources: one, two, three

    GrapeCity Documents PDF Viewer

    I currently have the “hello.pdf” and the gcpdfviewer javascripts in the same folder as the above index.html but every time I test the code in the browser, the PDF viewer loads, but the PDF doesn’t, giving me an error that states “missing PDF.”

    This is really bothering me because the PDF is exactly where it’s supposed to be, I think.

    I’m currently not using a license key, but the documentation makes it seems like I don’t need one. Maybe that’s the issue.

    Any ideas?

  • Posted 16 August 2020, 5:58 pm EST

    Hi William,

    Firstly, the issue is not because of the non-license version.

    The issue occurs because you are trying to execute the sample locally using the file system. To overcome this issue, you should host the application on a local server and the Pdf will be loaded in the PdfViewer.

    While loading a Pdf in the PdfViewer, there is XMLHttpRequest which checks the origin. This is null in the case of the file system. Hence, throws the error on accessing the file.

    Here is the documentation link for configuring the PdfViewer:

    https://www.grapecity.com/documents-api-pdf/docs/online/view-pdf.html

    Regards,

    Manish Gupta

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels