XRPdfContent.Source Property
Specifies the source PDF document in the binary data format. The control renders the specified document in the report.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v24.2.dll
NuGet Package: DevExpress.Reporting.Core
#Declaration
#Property Value
Type | Default | Description |
---|---|---|
Byte[] | *null* | The source PDF document in the binary data format. |
#Remarks
When users save the report, the Source property value persists in the report definition file.
You can use expressions to conditionally specify the Source property value or bind it to a report parameter or data source field. Add an ExpressionBinding item to the XRPdfContent.ExpressionBindings collection to set an expression.
Use the SourceUrl property instead of Source to provide a URL or path to a PDF file.
Tip
The Source
#Examples
The code sample below creates an XRPdfContent control, adds it to a report’s Detail band, and sets the control’s Source property to binary PDF data from a file.
using System.IO;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Expressions;
// ...
// Create a report that has a Detail band and uses Landscape page orientation.
XtraReport report = new XtraReport(){
Landscape = true,
Bands = {
new DetailBand() {
Name = "DetailBand",
HeightF = 25,
}
}
};
// Create an XRPdfContent class instance.
XRPdfContent pdfContent = new XRPdfContent();
// Assign binary PDF content to the XRPdfContent's Source property.
pdfContent.Source = System.IO.File.ReadAllBytes("MasterDetailReport.pdf");
// Add the XRPdfContent control to the Detail band.
report.Bands[BandKind.Detail].Controls.Add(pdfContent);
The code sample below creates an XRPdfContent control and uses an expression to bind the control’s Source property to the PdfData data source field.
using System.IO;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Expressions;
// ...
// Create a report that has a Detail band and uses Landscape page orientation.
XtraReport report = new XtraReport(){
Landscape = true,
Bands = {
new DetailBand() {
Name = "DetailBand",
HeightF = 25,
}
}
};
// Create an XRPdfContent class instance.
XRPdfContent pdfContent = new XRPdfContent();
// Create an expression that binds the XRPdfContent's Source property to the data source's "PdfData" field.
pdfContent.ExpressionBindings.Add(new ExpressionBinding("Source", "[PdfData]"));
// Add the XRPdfContent control to the Detail band.
report.Bands[BandKind.Detail].Controls.Add(pdfContent);