Close a Document from JS & Code behind !!

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
trupti
Posts: 4
Joined: Tue Apr 25, 2017 9:04 pm

Close a Document from JS & Code behind !!

Post by trupti » Thu Jun 01, 2017 8:00 pm

Hello,

Using GDPicture 14, DocuVieware ASP.NET web forms 4.5.

I have a buton to Close the open document. I can close the doc from the js function easily. But, I want to release & manage memory, so I am interested in doing it thru code behind. The problem with code behind is, I got to click the button twice, then only it works. Here's the code :

Javascript :

Code: Select all

        function closeDocument() {
            //DocuViewareAPI.PostCustomServerAction("docuView", true, "CloseDoc");   // To call code behind method
            DocuViewareAPI.CloseDocument("docuView");

            // Label text NOT getting CLEARED ????
            document.getElementById('<%=docNameLbl.ClientID%>').innerHTML = "";
        }
Code Behind :

Code: Select all

      public static void HandleCloseDocument(CustomActionEventArgs e)
        {

            // Release from memory
            int imgId;
            if (e.docuVieware.GetNativeImage(out imgId) == GdPictureStatus.OK)
            {
                GdPictureImaging gdImg = new GdPictureImaging();
                gdImg.ReleaseGdPictureImage(imgId);
            }

            // Close the document
            e.docuVieware.Close();
            
            
            return;
        }
Why is this difference between js & code behind ?? I just want to release the memory. Is their any other way to achieve the same ??

Thanks a lot,

Trupti

Bluffrat
Posts: 4
Joined: Tue Nov 21, 2017 4:42 pm

Re: Close a Document from JS & Code behind !!

Post by Bluffrat » Thu Feb 08, 2018 3:48 am

Does anyone have an answer for this??? I have the same issue. I believe France can get the answer!!! :wink:

Image

User avatar
Loïc
Site Admin
Posts: 5594
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Close a Document from JS & Code behind !!

Post by Loïc » Fri Feb 09, 2018 6:11 pm

Hi,
But, I want to release & manage memory, so I am interested in doing it thru code behind
This is exactly what the javascript function CloseDocument() is already doing. So you should definitively use it.
Also the custom action is quite wrong, especially here:

Code: Select all

if (e.docuVieware.GetNativeImage(out imgId) == GdPictureStatus.OK)
            {
                GdPictureImaging gdImg = new GdPictureImaging();
                gdImg.ReleaseGdPictureImage(imgId);
            }
From the documentation of GetNativeImage:
This image must not be released from the memory
In other words: remove this code :)

Cheers,

Loïc

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 1 guest