We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to hide the text box form field based on some condition (or) how to set the background color of text box field based on some condition

Hi,

I have a PDF with form fields in it. The PDF contains “allergies_label_pg1” text box form field with no back ground color and no border/no border style(this has been set using adobe acrobat XI pro).
Based on some condition, i’m setting the background color, width and style to the text box form field using below code.
var pdfForm = new Aspose.Pdf.Facades.Form();
pdfForm.BindPdf(dataDir + @"\samplePdf.pdf");
FormFieldFacade formFieldFacade1 = pdfForm.GetFieldFacade(“allergies_label_pg1”);
formFieldFacade1.BorderStyle = FormFieldFacade.BorderStyleSolid;
formFieldFacade1.BorderWidth = 1;
formFieldFacade1.BackgroundColor = System.Drawing.Color.LightCoral;
formFieldFacade1.BorderColor = System.Drawing.Color.Red;
pdfForm.FillField(“allergies_label_pg1”, “This patient has more than 5 adverse drug reactions. Please refer to page 5 for complete list.”);
pdfForm.Save(dataDir + @"\resultPdf.pdf");

The “resulrPdf.pdf” file doesn’t have the background color and style.

Any help appreciated.
Thanks in advance.

Hi Rajesh,


Thanks for your inquiry. Please check following documentation link for decorating an existing form field. Hopefully it will help you to accomplish the task. If issue persist then please share your sample document here, so we will look into it and provide you information accordingly.


Please feel free to contact us for any further assistance.

Best Regards,