All docs
V21.1
21.1
20.2
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.SourceUrl Property

Specifies the PDF document to be rendered in the report. Use a local file system path or URL to reference a document.

Namespace: DevExpress.XtraReports.UI

Assembly: DevExpress.XtraReports.v21.1.dll

Declaration

[SRCategory(ReportStringId.CatData)]
[DefaultValue("")]
public string SourceUrl { get; set; }

Property Value

Type Default Description
String

String.Empty

The URL or path to a PDF document that should be rendered in the report.

Remarks

When users save the report, the URL or path specified in the SourceUrl property persists in the report definition file. The PDF file should be available at the specified location when a report is printed or rendered in a Document Viewer.

You can use expressions to conditionally specify the SourceUrl property value or bind it to a report parameters or data source field. Add an item to the XRPdfContent.ExpressionBindings collection to set an expression.

Use the Source property instead of SourceUrl to include PDF content in a report.

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 below creates an XRPdfContent control, adds it to a report’s Detail band, and sets the control’s SourceUrl property to the path to a PDF document.

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();
// PDF content is loaded from the MasterDetail Report.pdf file.
pdfContent.SourceUrl = "MasterDetail Report.pdf";
// Add the XRPdfContent control to the Detail band.
report.Bands[BandKind.Detail].Controls.Add(pdfContent);

The code below creates an XRPdfContent control and uses an expression to bind the control’s SourceUrl property to the report’s PdfParameter parameter.

using System.IO;
using DevExpress.XtraReports.UI;
using DevExpress.XtraReports.Expressions;
// ...
// Create a report that has a Detail band and uses Landscape page orientation.
// The "PdfParameter" report parameter specifies the PDF file location.
XtraReport report = new XtraReport(){
    Landscape = true,
    Parameters = {
        new DevExpress.XtraReports.Parameters.Parameter() {
            Name = "PdfParameter",
            Type = typeof(string),
            Value = "MasterDetailReport.pdf",
            Visible = 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 SourceUrl property to the report's "PdfParameter" parameter.
pdfContent.ExpressionBindings.Add(new ExpressionBinding("SourceUrl", "?PdfParameter"));
// Add the XRPdfContent control to the Detail band.
report.Bands[BandKind.Detail].Controls.Add(pdfContent);
See Also