Hi,
The retrieveFormFields() function returns an object with the properties of each field. Is there a function to retrieve this same information in JSON format so that it can be stored in the database? I have been searching but I can't find if this function exists.
Thank you very much!
Hi Pere,
You can use our Submit form button in the toolbar menu to export it as JSON. This will export the form field value as Json.
Kindly find the image for the submit button.
Regards,
Visvesvar K V
Hi Visvervar,
I would need to be able to store the JSON in a JavaScript variable programmatically (without user interaction). Is this possible?
Thank you very much!
Hi Pere,
Thank you for your update.
Kindly find the sample for your requirement below.
Sample - https://stackblitz.com/edit/qnss5r?file=index.html,index.js
Regards,
Visvesvar K V
Hi Visvesvar,
Now works fine!!
Thank you very much!
Hi Pere,
Thank you for the update.
Regards,
Sinthiya K
Hi,
The exportData code still works.. great.
But the importData code from the stackBlitz example doesn't appear to work anymore?
On my local workstation it throws a "Webservice is not listening" error (but it is?) and on the stackBlitz workspace it isn't loading the PDF_Succinctly.pdf file for me.. When I try to load something else (eg. the "FormDesigner.pdf" file where I add a textbox form field called "FirstName") it always tells me "
Imported JSON file is not found in the desired location
" even when I pass it as a string. eg:
<snip ... rest of the code from the stackBlitz example>
--
Wil
Hi Pere,
We
were able to reproduce the reported issue "Unable to import Json value into form field” and suspect this to
be a defect. We will analyze further on this and update you with more details
on March 14th, 2024.
Regards,
Sathiyaseelan K
Thanks
Sathiyaseelan,
Looking forward to hear what you found.
--
Wil
Hi Pere Argelich,
It appears that the
data value was not properly set at the sample level. We need to update the
controller file by setting the provided data into the PDF Viewer server library
to resolve this issue.
Furthermore, we need
to verify that the provided data is a file or object before setting the values.
Code snippet:
[AcceptVerbs("Post")] [HttpPost("ImportFormFields")] [Microsoft.AspNetCore.Cors.EnableCors("MyPolicy")] [Route("[controller]/ImportFormFields")] public IActionResult ImportFormFields([FromBody] Dictionary<string, string> jsonObject) { PdfRenderer pdfviewer = new PdfRenderer(_cache); var importFormFieldData = GetDocumentPath(jsonObject["data"]); if (importFormFieldData == string.Empty) { var importformFieldDataObject= JsonConvert.DeserializeObject(jsonObject["data"]); if (importformFieldDataObject != null) { jsonObject["data"] = importformFieldDataObject.ToString(); } } else { jsonObject["data"] = importFormFieldData; }
object jsonResult = pdfviewer.ImportFormFields(jsonObject); return Content(JsonConvert.SerializeObject(jsonResult)); } |
Regards,
Sathiyaseelan K