PageInfoDataProviderBase.GetText(PrintingSystemBase, PageInfoTextBrickBase) Method

Enables you to obtain and customize the text of the Page Info control.

Namespace: DevExpress.XtraPrinting

Assembly: DevExpress.Printing.v20.2.Core.dll

Declaration

public abstract string GetText(
    PrintingSystemBase ps,
    PageInfoTextBrickBase brick
)
Public MustOverride Function GetText(
    ps As PrintingSystemBase,
    brick As PageInfoTextBrickBase
) As String

Parameters

Name Type Description
ps PrintingSystemBase

A PrintingSystemBase object.

brick PageInfoTextBrickBase

A PageInfoTextBrickBase descendant.

Returns

Type Description
String

A String value.

Remarks

In the following example, all PageInfo bricks are processed using the PageInfoDataProviderBase class. The GetText method returns information about the current HttpContext user.

using DevExpress.XtraPrinting;
using System.Web;
// ...

class CustomPageInfoDataProvider : PageInfoDataProviderBase {
    readonly HttpContext httpContext;
    public CustomPageInfoDataProvider(HttpContext httpContext) {
        this.httpContext = httpContext;
    }

    public override string GetText(PrintingSystemBase ps, PageInfoTextBrickBase brick) {
        if (brick.PageInfo != PageInfo.UserName) {
            return null;
        }
        if (httpContext == null)
            return "<No Information>";
        var user = httpContext.User;
        if (user == null || user.Identity == null)
            return "<Please enable Forms or Windows security>";
        var identity = user.Identity;
        return identity.IsAuthenticated
            ? identity.Name
            : "<Guest>";
    }
}
See Also