Unable to fill smart form and save.

Hi,

I have tried filling a smart form and saving it using Syncfusion PDF library. The form is getting saved without any data. 

Please see the code below. Any quick help on this would be greatly appreciated.

        Dim loadedDocument As New PdfLoadedDocument("D:\smartform2.pdf")
        Dim loadedForm As PdfLoadedForm = loadedDocument.Form
        Dim loadedTextBoxField As PdfLoadedTextBoxField = TryCast(loadedForm.Fields(1), PdfLoadedTextBoxField)
        loadedTextBoxField.Text = "Hello"
        loadedDocument.Save("D:\sample.pdf")
        loadedDocument.Close(True)
        loadedDocument.Dispose()


Thank you.


8 Replies

SR Srikanth November 21, 2017 08:45 AM UTC

Please see the attached form I was using in my code.

Thanks.

Attachment: smartform_34f8fdef.zip


SP Sathya Ponnusamy Syncfusion Team November 23, 2017 12:59 PM UTC

Hi Srikanth, 

Thank you for contacting Syncfusion support. 

We have checked your query ”I have tried filling a smart form and saving it using Syncfusion PDF library. The form is getting saved without any data” with updated PDF document. On further analyzed your document, in that document form fields contain CheckBoxField at the index position 1. Please find the attached screenshot for your reference. But in your updated code sample you have tried to cast the formfields[1] as PdfLoadedTextBoxField. So only you could not update the PdfLoadedTextBoxField values. Please select index for PdfLoadedTextBoxField to achieve your requirement.  

 

We have prepared simple sample for to fill PdfLoadedTextBoxFiled and it is available in the below link for your reference, 

Please let me know if you have any concern regarding this. 

Regards, 
Sathya  



SR Srikanth November 24, 2017 12:21 PM UTC

Hi,

Thanks for your response. I did check the functionality using the PDF document that you have uploaded and it works well. However, when I follow the same steps using the PDF document that I had uploaded on 21st November it does not give me a similar output.

Please can you check on the query using my PDF and let me know if you are able to generate the desired output.

Thanks,
Srikanth


SP Sathya Ponnusamy Syncfusion Team November 27, 2017 05:17 AM UTC

Hi Srikanth, 

Thanks for your update. 

We have checked your query. In our previous updated sample we have used SetDefaultAppearance value is false to display the updated TextBoxField values in loaded document. We suspect may be in your sample you have missed to update SetDefaultAppearance value.  
 
Dim loadedDocument As New PdfLoadedDocument("smartform.pdf") 
Dim loadedForm As PdfLoadedForm = loadedDocument.Form 
 
loadedForm.SetDefaultAppearance(False) 
 
Dim loadedTextBoxField As PdfLoadedTextBoxField = TryCast(loadedForm.Fields(0), PdfLoadedTextBoxField) 
loadedTextBoxField.Text = "Hello" 
loadedDocument.Save("D:\sample.pdf") 
loadedDocument.Close(True) 
loadedDocument.Dispose() 

Please try this in your side, if the issue is not resolved, please send us the output document which is helpful to proceed further in this. 

Regards, 
Sathya 



SR Srikanth January 8, 2018 11:37 AM UTC

Hello , 

Thank you for your response. I am trying to implement the same on another PDF(Online application for passport), However it only displays 2 active fields. We have attached the PDF document for your reference. We would kindly request you to look into the PDF and let us know if you are able to see all the fields. Looking forward for your findings.

Thank you.

Attachment: OnlinePassportForm_a5977c66.zip


SP Sathya Ponnusamy Syncfusion Team January 9, 2018 12:32 PM UTC

Hi Srikanth, 
  
Thank you for your update. 

We have confirmed the issue with "Form fields are missing in PdfLoadedFormFieldCollection for the specific document". We have internally logged the defect report regarding this issue and the fix for this issue will be included in our main release Volume 1 which is expected to be release on mid of February, 2018 .   

Regards, 
Sathya 



SR Srikanth March 26, 2018 12:25 PM UTC

Hi, 

I modified data in an existing excel file and then saved it with the same filename. However, when I tried to open the file again, it gave an error stating "File was corrupted" and I also lost the entire data.

Please can you help address this issue?.Prompt response will be highly appreciated.


AV Abirami Varadharajan Syncfusion Team March 27, 2018 10:50 AM UTC

Hi Srikanth, 
 
We are unable to reproduce the issue. We suspect that the issue is raised based on the data in your source document and the type of data such as conditional formatting, named range, formulas, table, pictures and so on gets added to the source worksheet. So, it will be more helpful to analyze, if you could share your code snippet along with the input document used to validate further from our side. 
 
It is also recommended to upgrade to our latest version 16.1.0.24 which may resolve issue at your end. It also includes more features, enhancements and bug fixes which is available for download under following link.   
 
 
Regards, 
Abirami. 


Loader.
Up arrow icon