cete.dynamicpdf.pageelements.transparencygroup
TransparencyGroup
- Namespace: ceTe.DynamicPDF.PageElements
- Assemblies: DynamicPDF.NETFramework40.dll, DynamicPDF.NETStandard20.dll
Represents a group of page elements that will have transparency.
public class TransparencyGroup : Group, IEnumerable, IPageElementContainer, ISerializable
Public Class TransparencyGroup
Inherits Group
Implements IEnumerable, IPageElementContainer, ISerializable
Inheritance: Object → PageElement → Group → TransparencyGroup
Implements: IEnumerable, IPageElementContainer, ISerializable
Licensing
This class is a DynamicPDF Generator Professional Edition feature. One of the following licenses is required for non-evaluation usage:
- DynamicPDF Generator for .NET Professional Edition
- DynamicPDF Generator for .NET Enterprise Edition
- DynamicPDF Merger for .NET Professional Edition
- DynamicPDF Merger for .NET Enterprise Edition
- DynamicPDF ReportWriter for .NET Professional Edition
- DynamicPDF ReportWriter for .NET Enterprise Edition
- DynamicPDF Core Suite for .NET Professional Edition
- DynamicPDF Core Suite for .NET Enterprise Edition
Examples
The following example will display text with a transparent rectangle over it. The text will be visible beneath the rectangle.
Imports System
Imports ceTe.DynamicPDF
Imports ceTe.DynamicPDF.PageElements
Module MyModule
Sub Main()
' Create a PDF Document
Dim MyDocument As Document = New Document
' Create a Page and add it to the document
Dim MyPage As Page = New Page
MyDocument.Pages.Add(MyPage)
' Create a transparency group and add a rectangle to it
Dim MyGroup As TransparencyGroup = New TransparencyGroup(0.5F)
MyGroup.Add(New Rectangle(50, 0, 100, 100, RgbColor.Red, RgbColor.Red))
' Add a label to the page
MyPage.Elements.Add(New Label("This text is beneath the rectangle.", 0, 0, 200, 12))
'Add the transparency group to the page
MyPage.Elements.Add(MyGroup)
' Save the PDF
MyDocument.Draw("C:\MyDocument.pdf")
End Sub
End Module
using System;
using ceTe.DynamicPDF;
using ceTe.DynamicPDF.PageElements;
public class Example
{
public static void CreatePDF(string outputPath)
{
// Create a PDF Document
Document document = new Document();
// Create a Page and add it to the document
Page page = new Page();
document.Pages.Add( page );
// Create a transparency group and add a rectangle to it
TransparencyGroup group1 = new TransparencyGroup( 0.5f );
group1.Add( new Rectangle( 50, 0, 100, 100, RgbColor.Red, RgbColor.Red ) );
// Add a label to the page
page.Elements.Add( new Label( "This text is beneath the rectangle.", 0, 0, 200, 12 ) );
// Add the transparency group to the page
page.Elements.Add( group1 );
// Save the PDF
document.Draw( outputPath );
}
}
Remarks
This class can be used to add transparency to page elements. Any page element that is placed in this group will be displayed with the transparency values and attributes of this group.
Constructors
TransparencyGroup(Single)
Initializes a new instance of the TransparencyGroup class.
public TransparencyGroup(float alpha)
Public Sub New (alpha As Single)
Parameters
- alpha: Single
Amount of transparency the group will have.
Remarks
An alpha value of 0 represents full transparency meaning the page elements will not be visible. An alpha value of 1 means the page elements will have no transparency.
TransparencyGroup(Single, BlendMode)
Initializes a new instance of the TransparencyGroup class.
public TransparencyGroup(float alpha, BlendMode blendMode)
Public Sub New (alpha As Single, blendMode As BlendMode)
Parameters
- alpha: Single
Amount of transparency the group will have.
- blendMode: BlendMode
Blend mode to use for the transparency group.
Remarks
An alpha value of 0 represents full transparency meaning the page elements will not be visible. An alpha value of 1 means the page elements will have no transparency.
Properties
BlendMode
Gets or sets the blend mode value.
public BlendMode BlendMode { get; set; }
Public Property BlendMode As BlendMode
Property Value
Count
Gets the number of page elements in the group. (Inherited from Group)
public int Count { get; }
Public Property Count As Int32
Property Value
FillAlpha
Gets or sets the fill alpha value.
public float FillAlpha { get; set; }
Public Property FillAlpha As Single
Property Value
ID
Gets or sets the ID of the page element. (Inherited from PageElement)
public string ID { get; set; }
Public Property ID As String
Property Value
Item[Int32]
Gets the PageElement object at the given index. (Inherited from Group)
public PageElement this[int index] { get; }
Public Property Item(index As Integer) As PageElement
Property Value
Item[String]
Gets the PageElement object with the given ID. (Inherited from Group)
public PageElement this[string id] { get; }
Public Property Item(id As String) As PageElement
Property Value
StrokeAlpha
Gets or sets the stroke alpha value.
public float StrokeAlpha { get; set; }
Public Property StrokeAlpha As Single
Property Value
Methods
Add(PageElement)
Adds a page element to the group. (Inherited from Group)
public void Add(PageElement pageElement)
Sub Add(pageElement As PageElement)
Parameters
- pageElement: PageElement
PageElement object to add to the group.
Draw(PageWriter)
Draws the transparency group to the given PageWriter object.
public void Draw(PageWriter writer)
Sub Draw(writer As PageWriter)
Parameters
- writer: PageWriter
PageWriter object to receive the transparency group's output.
Equals(Object)
Determines whether the specified Object is equal to the current Object . (Inherited from Object)
public bool Equals(Object obj)
Function Equals(obj As Object) As Boolean
Parameters
- obj: Object
The Object to compare with the current Object .
Returns
true if the specified Object is equal to the current Object ; otherwise, false.
GetEnumerator()
Returns an enumerator that can iterate through the Group . (Inherited from Group)
public IEnumerator GetEnumerator()
Function GetEnumerator() As IEnumerator
Returns
An IEnumerator for the entire Group
GetHashCode()
Serves as a hash function for a particular type. (Inherited from Object)
public int GetHashCode()
Function GetHashCode() As Integer
Returns
A hash code for the current Object .
GetPageElementByID(String)
Returns a page element with the given ID. (Inherited from Group)
public PageElement GetPageElementByID(string id)
Function GetPageElementByID(id As String) As PageElement
Parameters
- id: String
ID of the page element to find.
Returns
PageElement with the given ID.
GetType()
Gets the Type of the current instance. (Inherited from Object)
public Type GetType()
Function GetType() As Type
Returns
The Type instance that represents the exact runtime type of the current instance.
Insert(Int32, PageElement)
Inserts a page element to the group. (Inherited from Group)
public void Insert(int index, PageElement pageElement)
Sub Insert(index As Integer, pageElement As PageElement)
Parameters
- index: Int32
The Zero-based index it which the page element should be inserted.
- pageElement: PageElement
PageElement object to insert in the group.
ToString()
Returns a String that represents the current Object . (Inherited from Object)
public string ToString()
Function ToString() As String
Returns
A String that represents the current Object .