Want to Submit PDF viewer along with other html input fields

I have a form with some HTML controls and a PDF Viewer. Now I want to submit all form data along with PDF viewer jsonobject to server. On Server I would like to trigger the Controller Download function to get base64 data.

I looked around but could not find a way to capture PDF Viewer JsonObject (containing hashID etc) from javascript


1 Reply

PA Priyadharshini Annamalai Syncfusion Team December 9, 2024 10:53 AM UTC

Hi


In accordance with your requirements, we have provided a sample that demonstrates submitting form data along with the PDF Viewer JSON object to the server. The sample utilizes the ajaxRequestInitiate event, which allows customization of the JSON data being sent to the server. The implementation also includes triggering the server-side controller's download function to retrieve the base64 data.

Please review the sample and try integrating it into your application. If you encounter any issues or need further assistance, do let us know. Your feedback will help us analyze the scenario in detail and provide the necessary support.

Sample:

Client: Nvurpg (forked) - StackBlitz

Server: WebService

Documentation: JavaScript (ES5) PDF Viewer API control - Syncfusion

Code snippet:

viewer.ajaxRequestInitiate = function (args) {

  if (args.JsonData['action'] === 'Download') {

    args.JsonData['formKey'] = 'formValue'; // Set custom JSON data

    viewer.setJsonData(args.JsonData);

  }

};


Steps:

1. Open the Service Sample and run it.

2. Open the Client-Side Sample.


Regards,

Priyadharshini



Loader.
Up arrow icon