I am using Aspose.Pdf 10.5.1.
When setting the Annotation.Characteristics.Background property, the alpha channel is ignored. This is the case whether I set the property directly or use the FormFieldFacade class. Indeed, when I inspect the property in debug mode, the alpha channel is set to 255, no matter what I attempt to set it to.
Here is some example code...
Without facades
using (var inputPdf = new FileStream(INPUTPDF, FileMode.Open, FileAccess.Read))
using (var outputPdf = new FileStream(OUTPUTPDF, FileMode.Create, FileAccess.Write))
using (var document = new Document(inputPdf))
{
foreach (var field in document.Form.Fields)
{
var textBoxField = field as TextBoxField;
if (textBoxField != null)
{
textBoxField.Characteristics.Background = System.Drawing.Color.FromArgb(100, 222, 228, 254);
}
}
document.Save(outputPdf);
}
With facades
using (var inputPdf = new FileStream(INPUTPDF, FileMode.Open, FileAccess.Read))
using (var outputPdf = new FileStream(OUTPUTPDF, FileMode.Create, FileAccess.Write))
using (var document = new Document(inputPdf))
using (var editor = new FormEditor(document))
{
var facade = new FormFieldFacade();
editor.Facade = facade;
facade.BackgroundColor = System.Drawing.Color.FromArgb(100, 222, 228, 254);
foreach (var field in document.Form.Fields)
{
var textBoxField = field as TextBoxField;
if (textBoxField != null)
{
editor.DecorateField(field.FullName);
}
}
document.Save(outputPdf);
}
In both cases, the result is that the background color of all the text box fields on the form is set to System.Drawing.Color(255, 222, 228, 254).
This makes it very difficult to mimic fields created using Adobe Acrobat. Is there any work around to this problem? Am I missing something?
-Thanks