How do I Convert PDF into Fillable form PDF, Retrieve the filled out PDF's data and store the data as varBinary code in database?

How do I Convert PDF into Fillable form PDF, Retrieve the filled out PDF's data and store the data as varBinary code in database?


I understand the PDF fillable form would be a separate file, so I made some changes to the Download function in my Controller as bellow.


When I download the file, it is saved as a new pdf named "output.pdf". But none of the text box and button information is saved over.


View:

@Html.EJS().PdfViewer("pdfviewer").ServiceUrl(VirtualPathUtility.ToAbsolute("~/Home")).EnableAnnotation(true).EnableDownload(true).EnableHandwrittenSignature(true).EnableMagnification(true).EnableToolbar(true).EnablePrint(true).EnableFreeText(true).ValidateFormFields("validateFormFields").EnableFormFieldsValidation(true).ButtonFieldClick("submitButton").DocumentPath(@"~\Files\MyPDF.pdf").DocumentLoad("documentLoad").DownloadEnd("documentLoad").Render()




Controller:

[HttpPost]

public ActionResult Download(jsonObjects jsonObject)

{

PdfRenderer pdfviewer = new PdfRenderer();

var jsonData = JsonConverter(jsonObject);

string documentBase = pdfviewer.GetDocumentAsBase64(jsonData);

string base64String = documentBase.Split(new string[] { "data:application/pdf;base64," }, StringSplitOptions.None)[1];


if (base64String != null || base64String != string.Empty)

{

byte[] byteArray = Convert.FromBase64String(base64String);

System.IO.File.WriteAllBytes(@"~\Files\output.pdf", byteArray);

}

return Content(string.Empty);

}


2 Replies

DM Dhivyabharathi Mohan Syncfusion Team July 21, 2021 02:55 PM UTC

Hi Adam, 
 
 
Thank you for contacting Syncfusion support. 
 
 
We were able to reproduce the reported issue “Form fields are not added in the downloaded document“. We will analyze further and provide the details on July 23, 2021. 
 
 
Regards, 
Dhivya. 
 



DM Dhivyabharathi Mohan Syncfusion Team July 23, 2021 12:48 PM UTC

Hi Adam, 
 
 
We have checked the MVC sample. In this, we need to add the formDesigner key module in the model class to get the issue resolved. We have shared the sample in the latest version. Please find the sample from the below link. 
 
 
 
 
Kindly try this and revert us, if you have any concerns. 
 
 
Regards, 
Dhivya. 


Loader.
Up arrow icon