I need to create a FloatingBox with a semi-transparent background color, and the Aspose.Pdf.Color doesn’t seem to respect the alpha value I’m providing. Here is my code:
public void FloatingBoxWithSemiTransparentBackground()
{
var pdf = new Document(@“c:\Temp\source.pdf”);
var page = pdf.Pages[1];
var semiTransparentYellow = System.Drawing.Color.FromArgb(100, System.Drawing.Color.Yellow);
var asposeVersionOfYellow = Aspose.Pdf.Color.FromRgb(semiTransparentYellow);
var floatingBox = new FloatingBox(100, 200) { Left = 30, Top = 40, BackgroundColor = asposeVersionOfYellow };
page.Paragraphs.Add(floatingBox);
pdf.Save(@“c:\Temp\alpha_test.pdf”);
}
The saved PDF does have the floating box in the right location and with the right RGB, but it is completely opaque.
How can I get the FloatingBox.BackgroundColor to respect alpha?