Does PDF Viewer require the viewer? If so, can it be loaded from CDN

Posted by: jsacks on 17 August 2021, 3:40 am EST

    • Post Options:
    • Link

    Posted 17 August 2021, 3:40 am EST

    We’d like to load GcPdfViewer from the jsdeliver CDN (https://cdn.jsdelivr.net/npm/@grapecity/gcpdfviewer/gcpdfviewer.min.js) because we can’t use NPM and want to always get the latest version.

    However, it doesn’t seem like we can load the worker from the CDN (https://cdn.jsdelivr.net/npm/@grapecity/gcpdfviewer/gcpdfviewer.worker.js)

    So two questions:

    1. Is the worker even needed? In your PureJS example it is not used (https://www.grapecity.com/documents-api-pdfviewer/demos/view-pdf/purejs)

    However, we are using Typescript and it’s not working without the worker. Is it required for working with the viewer with TypeScript?

    1. If the worker is required, can we load it from the CDN like the main viewer script? Again, we can’t use NPM and don’t want to manage JS dependencies locally.

    Thank you.

  • Posted 17 August 2021, 3:50 pm EST

    Hi,

    We are able to replicate the error and we have forwarded this to the concerned team for further investigation with the internal tracking id: DOC-2804. We will let you know as we get an update on this.

    Regarding worker file:

    We may avoid for now or copy the file locally and provide the worker file link as follows:

    viewer = new GcPdfViewer(selector, {
                workerSrc:"http://localhost:59137/Scripts/js/gcpdfviewer.worker.min.js"
            });
    

    If you are not including the file, it will affect the performance while loading the PDF file. But you will be able to load the Pdf file in the viewer.

    Hope it helps!

    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