Closing a PDF and releasing server resources

Posted by: aheath on 6 October 2023, 11:23 am EST

  • Posted 6 October 2023, 11:23 am EST

    We noticed our SupportAPI isn’t releasing resources after calling the dispose() method on our PDF Viewer. We noticed there’s also a close method (https://www.grapecity.com/documents-api-pdfviewer/api/classes/GcPdfViewer.html#close) on the viewer so we also tried calling that with the same results. What’s the proper way to close a PDF while releasing the server resources?

    We found a close endpoint on the SupportAPI server but it doesn’t seem to be called by any of the built-in viewer methods. Are we supposed to make a request to that endpoint directly?

    Thanks

  • Posted 9 October 2023, 5:29 am EST

    Hello,

    Could you please share your use case for a better understanding of your request? Also, if you are facing any issues because of this.

    The close() method of the GcPdfViewer only closes the files opened in the Viewer but it keeps connectivity with the SupportApi. Also, the dispose() method, closes the file and removes the GcPdfViewer, and frees up the client resources.

    Also if this is affecting your application, you may use the following code snippet to call the SupportApi close API.

    var url = `${viewer.options.supportApi.apiUrl}/close/${viewer.supportApi.clientId}`;
    fetch(url).then(function (res) {
        if(res.ok){
            console.log("Support API resources get free!!!");
        }
    })

    Hope it helps!

    Regards,

    Manish Gupta

  • Posted 25 February 2024, 11:37 pm EST

    Hello,

    This issue has been fixed in the latest build 7.0.3 so please get the latest build from NPM. https://www.npmjs.com/package/@mescius/dspdfviewer

    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