Imports System.IO Imports DevExpress.XtraPrinting Public Class ReportCreator Public Shared Async Function CreateReport(pReportItems As List(Of ReportItem)) As Task(Of Byte()) Dim oSource As New ReportSource With {.Items = pReportItems} Dim oReport As New rptEnvelopeHistory() With {.DataSource = oSource, .DataMember = "Items"} Await oReport.CreateDocumentAsync() Using oStream As New MemoryStream() Await oReport.ExportToPdfAsync(oStream, New PdfExportOptions) Return oStream.ToArray() End Using End Function End Class