Skip to main content
All docs
V25.1
  • Use PDF Documents in Business Objects (CTP)

    • 2 minutes to read

    Blazor and WinForms XAF applications allow you to display PDF documents in a PDF Viewer property editor. The editor can display PDF documents stored in properties of the following types:

    • Byte array
    • Types that implement the IFileData interface

    Important

    The PDF Viewer Property Editor is currently available as a Community Technology Preview (CTP).

    Tip

    Try out the PDF Viewer in the MainDemo.NET.EFCore demo application installed as part of the XAF package. The default application location is %PUBLIC%\Documents\DevExpress Demos 25.1\Components\XAF\MainDemo.NET.EFCore.

    PDF Viewer in an XAF Blazor Application

    You can add the PDF Viewer to your application as follows:

    1. Enable the Office Module.
    2. Assign PdfViewerPropertyEditor to a file data property in code or in the Model Editor (MySolution.Blazor.Server\Model.xafml (for Blazor) or MySolution.Win\Model.xafml (for WinForms)).

    Assign the PDF Viewer Property Editor to a Property in Code

    Decorate a business class property with the EditorAliasAttribute and pass the PdfViewerPropertyEditor value as the attribute parameter:

    using DevExpress.ExpressApp.Editors;
    using DevExpress.Persistent.Base;
    using DevExpress.Persistent.BaseImpl.EF;
    // ...
    [EditorAlias(EditorAliases.PdfViewerPropertyEditor)] 
    public virtual byte[] Data { get; set; }
    

    Assign the PDF Viewer Property Editor to a Property in the Model Editor

    1. Double-click the corresponding Model.xafml file to start the Model Editor:
      • MySolution.Blazor.Server\Model.xafml (for Blazor)
      • MySolution.Win\Model.xafml (for WinForms)
    2. Navigate to the following node: Views | {AppName}.Module.BusinessObjects | {ObjectType} | {ObjectType}_DetailView | Items | {Property Name}.
    3. Set the PropertyEditorType property to one of the following values:

      • DevExpress.ExpressApp.Office.Blazor.Editors.PdfViewerPropertyEditor (for Blazor)
      • DevExpress.ExpressApp.Office.Win.PdfViewerPropertyEditor (for WinForms)

    PropertyEditorType property in Model Editor