Skip to main content
A newer version of this page is available. .

WebDocumentViewerOperationLogger Class

A service enabling you to log events related to processing reports and generated documents by the Web Document Viewer engine.

Namespace: DevExpress.XtraReports.Web.WebDocumentViewer

Assembly: DevExpress.XtraReports.v19.1.Web.dll

NuGet Package: DevExpress.Web.Reporting.Common

Declaration

public class WebDocumentViewerOperationLogger

Remarks

To register a WebDocumentViewerOperationLogger service, add it to a DefaultWebDocumentViewerContainer or use the DefaultWebDocumentViewerContainer.RegisterSingleton<T, TImpl> method of the DefaultWebDocumentViewerContainer class.

To provide synchronous building of report documents (e.g., to enable accessing HttpContext values in the XRControl.BeforePrint event handlers of a report), use the WebDocumentViewerOperationLogger.BuildStarting method.

The following example illustrates how to use the WebDocumentViewerOperationLogger to restrict exporting a report to any format except PDF. Although the export options available to end-users may be also customized on the client, the server-side approach illustrated below is preferred in some scenarios.

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

public class MyOperationLogger : WebDocumentViewerOperationLogger {
    public override void ExportDocument(string documentId, string format, ExportOptions options, PrintingSystemBase printingSystem) {
        if (format != "pdf") {
            throw new NotSupportedException(String.Format("Export to {0} format is not allowed!", format.ToUpper()));
        }
         // Specify the default PDF export options.
        options.Pdf.Assign(new PdfExportOptions());
         base.ExportDocument(documentId, format, options, printingSystem);
    }
}

To register a custom operation logger, call the DefaultWebDocumentViewerContainer.RegisterSingleton<T, TImpl> or DefaultWebDocumentViewerContainer.Register<T, TImpl> method at the application startup.

using DevExpress.XtraReports.Web.WebDocumentViewer;
// ...

protected void Application_Start(object sender, System.EventArgs e) {
    // ...
    DefaultWebDocumentViewerContainer.RegisterSingleton<WebDocumentViewerOperationLogger, MyOperationLogger>();
}

For other code samples, see the following examples online.

Inheritance

Object
WebDocumentViewerOperationLogger
See Also