expressappframework-405488-document-management-office-module-use-pdf-documents-in-business-objects.md
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:
Note
WinForms PDF Viewer saves documents in database as IFileData or byte[].
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.2\Components\XAF\MainDemo.NET.EFCore.
You can add the PDF Viewer to your application as follows:
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)).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; }
using DevExpress.ExpressApp.Editors;
using DevExpress.Persistent.Base;
using DevExpress.Persistent.BaseImpl;
// ...
private byte[] data;
[EditorAlias(EditorAliases.PdfViewerPropertyEditor)]
public byte[] Data {
get { return data; }
set { SetPropertyValue(nameof(Data), ref data, value); }
}
In WinForms applications, you select the Show in popup context menu command to open the document in a new popup window.