3 Answers, 1 is accepted
0
Hi Kurt,
We have a great example demonstrating how to modify the form field values of a PDF document and save the result. You can find it in our developer focused examples: https://github.com/telerik/document-processing-sdk/tree/master/PdfProcessing/ModifyForms//.
Hope this helps.
Regards,
Polya
Progress Telerik
We have a great example demonstrating how to modify the form field values of a PDF document and save the result. You can find it in our developer focused examples: https://github.com/telerik/document-processing-sdk/tree/master/PdfProcessing/ModifyForms//.
Hope this helps.
Regards,
Polya
Progress Telerik
0
Kurt
Top achievements
Rank 1
answered on 14 May 2018, 05:02 PM
Hi Polya,
I don't see anything in that example relating to "renaming an existing form field".
Did you mean to paste a different reference link?
- Kurt
0
Hello Kurt,
I assumed that by "rename an existing form field" you meant changing the value of the field. If that is not the case, please excuse my misunderstanding.
If you wish to change the Name property of a FormField, currently there is no out-of-the box way to achieve that. You can find a feature request for this logged in our Feedback Portal: https://feedback.telerik.com/Project/184/Feedback/Details/249535-pdfprocessing-provide-a-way-to-rename-formfields where you can track its status and vote for it.
As a way to achieve the desired, you could create a new instance of a FormField with the desired name, add the new field in the document and remove the old one. You can use the following approach:
1) Create a new instance of FormField (with the desired name, passed in the constructor), which will play the role of a copy of a specific FormField
2) Copy all properties from the original field (they all vary, depending on the concrete type of the FormField, for example CheckBoxField, etc.)
3) Create a new widget for the new field, and copy all properties from the original field's widget into the new one.
4) Remove the original field from the RadDocument.AcroForm.FormFields collection and add the new field.
5) Remove the original widget from the corresponding page's annotation and add the new one.
I've prepared a sample project demonstrating this approach. Please find it attached.
If this is what you wish to achieve, I hope this approach helps. If, however, it is not, I will kindly ask you to provide more information on your scenario and what do you mean by renaming an existing form field.
Regards,
Polya
Progress Telerik
I assumed that by "rename an existing form field" you meant changing the value of the field. If that is not the case, please excuse my misunderstanding.
If you wish to change the Name property of a FormField, currently there is no out-of-the box way to achieve that. You can find a feature request for this logged in our Feedback Portal: https://feedback.telerik.com/Project/184/Feedback/Details/249535-pdfprocessing-provide-a-way-to-rename-formfields where you can track its status and vote for it.
As a way to achieve the desired, you could create a new instance of a FormField with the desired name, add the new field in the document and remove the old one. You can use the following approach:
1) Create a new instance of FormField (with the desired name, passed in the constructor), which will play the role of a copy of a specific FormField
2) Copy all properties from the original field (they all vary, depending on the concrete type of the FormField, for example CheckBoxField, etc.)
3) Create a new widget for the new field, and copy all properties from the original field's widget into the new one.
4) Remove the original field from the RadDocument.AcroForm.FormFields collection and add the new field.
5) Remove the original widget from the corresponding page's annotation and add the new one.
I've prepared a sample project demonstrating this approach. Please find it attached.
If this is what you wish to achieve, I hope this approach helps. If, however, it is not, I will kindly ask you to provide more information on your scenario and what do you mean by renaming an existing form field.
Regards,
Polya
Progress Telerik