XColor Alpha Property. The alpha opacity. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

 

Type Default Read Only Description
[C#] int

[Visual Basic]
Integer
255 No The alpha opacity.

 

   

Notes
 

Allows you to get or set the alpha opacity of the color.

Alpha values can range from 0 to 255. Zero indicates fully transparent and 255 indicates fully opaque.

 

   

Example
 

Here we create a PDF document showing how different values of alpha result in different levels of transparency.

[C#]
Doc theDoc = new Doc();
theDoc.Rect.Inset(20,20);
theDoc.FontSize = 300;
for (int i = 1; i <= 10; i++) {
  theDoc.Color.Alpha = 255 / i;
  theDoc.AddText(theDoc.Color.Alpha.ToString());
  theDoc.Rect.Move(25, -50);
}
theDoc.Save(Server.MapPath("coloralpha.pdf"));
theDoc.Clear();

[Visual Basic]
Dim theDoc As Doc = New Doc()
theDoc.Rect.Inset(20,20)
theDoc.FontSize = 300
For i As Integer = 1 To 10
  theDoc.Color.Alpha = 255 / i
  theDoc.AddText(theDoc.Color.Alpha.ToString())
  theDoc.Rect.Move(25, -50)
Next
theDoc.Save(Server.MapPath("coloralpha.pdf"))
theDoc.Clear()


coloralpha.pdf