All docs
V20.1
20.1
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

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.v20.1.dll

Declaration

[SRCategory(ReportStringId.CatData)]
public byte[] Source { get; set; }
<SRCategory(ReportStringId.CatData)>
Public Property Source As Byte()

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 SourceUrl property value takes precedence over the Source value. If you specify both properties, the XRPdfContent includes the content specified by SourceUrl. However, if the file specified in the SourceUrl property cannot be loaded, the binary data from the Source property is used.

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 with a Detail band and 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();
// Obtain the binary PDF data and assign it to the XRPdfContent's Source property.
pdfContent.Source = System.IO.File.ReadAllBytes("MasterDetailReport.pdf");
// Assign the XRPdfContent class instance to the report's 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 with a Detail band and 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]"));
// Assign the XRPdfContent class instance to the report's Detail band.
report.Bands[BandKind.Detail].Controls.Add(pdfContent);
See Also