Loading images to an specific instance.

Discussions about DocuVieware integration in GdPicture.NET.
Post Reply
Alex
Posts: 4
Joined: Mon Apr 16, 2018 6:39 pm

Loading images to an specific instance.

Post by Alex » Fri Apr 20, 2018 7:46 pm

Hi, I'm trying to load documents from a database, I have a table in angular that displays the data on my table, so when I click on an specific record I want to load the image attached to that record on the docuvieware I've got. So how I'm I supposed to do this? The way I'm doing it right now is creating a new docuvieware each time I click. But is there any way I only have one instance, and send the desired file to that specific vieware?

Thanks.

Alex
Posts: 4
Joined: Mon Apr 16, 2018 6:39 pm

Re: Loading images to an specific instance.

Post by Alex » Mon Apr 23, 2018 9:06 pm

No answer yet, so, what I'm trying to do, is to load a file from an array of bytes to an specific vieware. So far what I've accomplished is to create more, and more viewares but no to load it to the original one. Here's a bit of code of what I've been doing.

Code: Select all

public DocuViewareRESTOutputResponse PostShow(DisplayDocuvieware displayConfig)
        {
            if (!DocuViewareManager.IsSessionAlive(displayConfig.SessionId))
            {
                Console.WriteLine("La session is inactive");
            }
            GdPicture14.WEB.DocuVieware docuviewareInstance = new GdPicture14.WEB.DocuVieware(displayConfig.SessionId);

            using (StringWriter controlOutput = new StringWriter())
            {
                if (displayConfig.File != null)
                {
                    Stream str = new MemoryStream(displayConfig.File);
                    docuviewareInstance.ID = displayConfig.ControlId;
                    docuviewareInstance.LoadFromStream(str, true);
                }
                docuviewareInstance.RenderControl(controlOutput);
                DocuViewareRESTOutputResponse output = new DocuViewareRESTOutputResponse
                {
                    HtmlContent = controlOutput.ToString()
                };
                return output;
            }
        }
The DisplayDocuveware only has the sessionID, the ControlID and the array of bytes I'm trying to load. I'm using the sample rest api for the Angular project.

Cedric
Posts: 269
Joined: Sun Sep 02, 2012 7:30 pm

Re: Loading images to an specific instance.

Post by Cedric » Tue Jan 22, 2019 4:36 pm

I'm not sure if this still an issue but you shouldn't have to recreate a new instance each time you want to display another document, you just need to reuse the previous one if it has been created.

I would strongly recommend to follow what is done in the dedicated tutorial here: https://www.docuvieware.com/guides/aspn ... 20API.html

It demonstrates how to properly serve a DocuVieware control through a REST service and how to retrieve an existing session if it exists.

Post Reply

Who is online

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