We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Save success message

Hello,

I'm looking to allow the user to fill PDF forms via the pdf viewer - please refer to the attached sample shared that was provided to me on a seperate thread. I'm looking to provide the user a custom "Save" button (rather than using the Download button on the PDF Viewer), that will basically call the Download method on the server side that will save the filled document.

I'm using the below javascript to make the call on the button click:

    function savePdf() {
        var pdfviewerObj = $("#pdfviewer").data("ejPdfViewer");
        pdfviewerObj.download();
        alert("done");
    }

Ideally, I would like to show the user a "Save Successful" message after the save is done on the server side. However, I'm observing that when I call the pdfViewerObj.download() method, it does not wait for the method to complete on the server-side, and immediately goes to the next line and shows "Done". This is not the behavior I was looking for, because I would like the download() call to wait for the server side method to execute successfully before going to the next line.

Is there any workaround to this? Or any other way so that I can show a "Success" message after the Download() method executes on the server side.

Thanks.


Attachment: PdfViewer_MVCsample1139086068_b50f6eb7.zip

1 Reply

RT Ramya Thirugnanam Syncfusion Team April 22, 2019 06:10 AM UTC

Hi Saurabh, 
 
Thanks for contacting Syncfusion support. 
 
We can show the alert message after the execution of the download() API of ejPdfViewer control by passing a boolean value to the download(isAsynchronous) API. Initially, the download() API will behave asynchronously. When the “isAsynchronous” parameter is set false, the request for download will behave synchronous and the alert will be executed after the completion of download(isAsynchronous) API. Please find the code example below for the download(isAsynchronous) API. 
 
Code Example: 
 
        var pdfviewer = $("#pdfviewer").data("ejPdfViewer"); 
        pdfviewer.download(false); 
        alert("Done"); 
                                                                                                                                               
We have modified the sample to achieve your requirements and it can be downloaded from the following link. 
                                                                                                                                               
 
Regards, 
Ramya T 


Loader.
Live Chat Icon For mobile
Up arrow icon