Can anyone tell me how to set the facade values of a single form field and then save them? What's the magic behind saving a facade for a single form field?
Sample below:
string _value = form.GetField("topmostSubform[0].Page1[0].txtContactAddressZip[0]");
form.FillField ("topmostSubform[0].Page1[0].txtContactAddressZip[0]", "111111");
FormFieldFacade _facade = form.GetFieldFacade("topmostSubform[0].Page1[0].txtContactAddressZip[0]");
_facade.TextColor = Color.DarkGreen;
_facade.BackgroudColor = System.Drawing.Color.FromArgb(0xCC, 0xCC, 0xCC);
_facade.BorderStyle = FormFieldFacade.BDSTYLE_BEVELED;
form.Save();
Question: How do I get the facade values to save on this field? The field value is saved, but not the facade values ("styles"). I only want to change the facade values of a single field.
Hi Paul,
You can use the following code snippet you set and save facade for a form field.
//create FormEditor instance
FormEditor theEditor = new FormEditor(“input.pdf”, “output.pdf”);
//create FormFieldFacade instance
FormFieldFacade facade = new FormFieldFacade();
//set facade properties
facade.BackgroudColor = System.Drawing.Color.Red;
//assign facade to FormEditor object
theEditor.Facade = facade;
//decorate field
theEditor.DecorateField(“fieldname”);
//save output form
theEditor.Save();
Please try this code at your end. If you find any problems then please do let us know; also, share the PDF file as well so we could into the matter at your end.
We're sorry for the inconvenience.
Regards,
Support,
Are you stating that I can't set the form field value and the facade value for a field using the same object? Do I also have to issue multiple Save statements? It seems kind of redundant to have to issue multple save statements to set a field value along with a facade value on a field. Can the file be accessed in the same context without problems? Why would I need to open the same file again to set the decorator values? Is there a way to set the field value and the decorator values in the same file handle context? The example below loses it's field value once the facade value is saved. How does one preserve the original field value when changing the facade?
Example:
Form form = new Form("input.pdf", "output.pdf");
//set field value
form.FillField ("topmostSubform[0].Page1[0].txtContactAddressZip[0]", "111111");
//save field value
form.Save();
FormEditor forme= new FormEditor("input.pdf", "output.pdf");
FormFieldFacade _facade = new FormFieldFacade();
_facade.TextColor = Color.DarkGreen;
//set facade value on field
forme.DecorateField("("topmostSubform[0].Page1[0].txtContactAddressZip[0]"");
//save facade value
forme.Save();
Thanks.
Hi Paul,
In order to fill a field’s value and set Facade you’ll have to issue two statements. This is due to the fact that Form class is used to fill the field’s value while FormEditor class is used to set the FormFieldFacade.
Regarding the issue you’re facing with your file, can you please share the PDF file you’re having problem with. We’ll have to test the issue with that first and then we’ll be able to fix it.
We’re sorry for the inconvenience.
Regards,