FormField Non-Edit Color

I can change the style of a FormField (Text) easily for when it is selected:

ff1.BackgroundColor = ControlBackgroundColor;

ff1.TextFontName = "Arial";

ff1.TextFontSize = 8;

ff1.BorderColor = System.Drawing.Color.FromArgb(0, 0, 0);

ff1.IsBordered = true;

But is there a way to change it when the field is not selected? My non-selected fields are all a kind of pale blue, and I would like them to be a different color, with a border.

Thanks!

Hello David,

Thanks for your interest in our products.

I’m afraid I’m unable to totally understand your problem. I’ve tried to replicate the issue over my end and as per my understanding; I’m unable to notice the issue.

In my case, I’ve created a text FormField with background color and sample text inside it. When I open the resultant PDF document, I can see the formatting information applied over the text field. Can you please take a look over the attached PDF document which is generated using the following code snippet.

[C#]

Pdf pdf1 = new Pdf();
Aspose.Pdf.Section sec1 = pdf1.Sections.Add();

FormField ff1 = new FormField();
ff1.FormFieldType = FormFieldType.Text;
ff1.BackgroundColor = System.Drawing.Color.FromArgb(10, 220, 0);
ff1.TextFontName = "Arial";
ff1.TextFontSize = 12;
ff1.BorderColor = System.Drawing.Color.FromArgb(0, 0, 0);
ff1.IsBordered = true;
ff1.FieldValue = "sample text";
ff1.FieldName = "FirstField";
ff1.FormWidth= 100;
ff1.FormHeight = 30;

sec1.Paragraphs.Add(ff1);
pdf1.Save(@"d:/pdftest/FormFieldTest.pdf");

From your statement in last line “My non-selected fields are all a kind of pale blue, and I would like them to be a different color, with a border”, I’m having an impression that you’re trying to apply some formatting over any existing PDF Form. Please correct me if I’ve not properly understood your requirement.

It would be great if you could share some details regarding the issue. We apologize for your inconvenience.

Nayyer:

I've attached a screen shot of a PDF (pdf.jpg) with some notations on colors. The PDF in your example also had a light blue field (on a white background).

Thanks!

Hello David,<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for sharing the information.

As far as I can see you're using Adobe Reader version greater than 7.0. In fact, there is an option in Adobe Reader to highlight the form fields within the document. The blue color for unselected fields and yellow color for selected fields is not applied by Aspose.Pdf but it’s a behavior of Adobe Reader.

I've created a PDF document with two form fields. When I've selected to view the document with Adobe Reader 7.0, I'm unable to notice this color problem. Whereas, when I've tried viewing the same document with Adobe Acrobat Professional 9.0, I'm able to see the blue color. Please take a look over the two image files in attachment for more clear understanding of the scenario.