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.v18.2.Web.dll

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.

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the WebDocumentViewerOperationLogger class.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

Inheritance

Object
WebDocumentViewerOperationLogger
See Also