Hello
I am using a Merge Document, to add values to named fields on a pdf (_pdfDoc.Form.Fields["fieldName"].Value = “a value”;).
I would like to know how I could dynamically change the color of a fields text. Is this possible ?
Thanks
(I am using C# .net for code behind.)
Merge document change font color
Re: Merge document change font color
Support · Apr 22, 2009Hello,
Currently it is not possible to change the properties of an existing form field. You can only fill the form fields with values. It is not possible to change the color of the form field text.
However you can replace the form field with a colored text. You can use the CreateLabel method of the PdfFormField object which can add a colored text in place of the form field. You can refer to the Form Flattening
topic on our help documentation for the CreateLabel method.
We may add this feature of setting color to an existing form field in future. but currently we do not have any immediate plans on this.
Thanks,
ceTe Software Support Team.
Re: Merge document change font color
Forum member · Apr 22, 2009I appreciate the example, and am able to replace the value of a field with a label as is shown. However, the focus of our use is to first populate all the fields, and then to change color of fields which fail certain criteria.
I don't appear to be able to populate the fields if i am using the pdfdocument object to create a label, I was able to populate the fields when using a merge document. Is there a solution where i could use an object(s) to first populate fields, and then replace fields with a label for coloring afterwards?
Re: Merge document change font color
Forum member · Apr 22, 2009I was able to get the Merge document to work, by using the Merge option of All when creating the merge document. I am not sure of the syntax for changing the color of a label. I am using this:
pdfDocument.Form.Fields["Section1_Line1"].CreateLabel(_pdfDoc.Pages[0], "Changed This", Font.CourierBold,12,ceTe.DynamicPDF.TextAlign.Justify,Magenta);
What is the syntax for the last parameter, a color, supposed to be ?
(thank you for any help)
Re: Merge document change font color
Support · Apr 22, 2009Hello,
The Color is an abstract class of the ceTe.DynamicPDF namespace. You can use other sub color classes. You can refer to the Colors
and the CreateLabel
constructor on our help documentation.
Thanks,
ceTe Software Support Team.