|
2 | 2 | title: PDF Content |
3 | 3 | author: Sergey Andreev |
4 | 4 | --- |
| 5 | + |
5 | 6 | # PDF Content |
6 | 7 |
|
7 | | -**PDF Content** is a control that renders PDF content in a report. |
| 8 | +The **PDF Content** control allows you to render PDF file content in two ways: |
| 9 | + |
| 10 | +* *Default*. Render each PDF file page as a separate report page. |
| 11 | + |
| 12 | +  |
| 13 | + |
| 14 | +* Embed PDF content into a report. |
| 15 | + |
| 16 | +  |
| 17 | + |
| 18 | + Refer to the following documentation section for more details: [Embed PDF File Content into a Report](#embed-pdf-file-content-into-a-report). |
| 19 | + |
| 20 | +## Add the PDF Content Control to a Report |
8 | 21 |
|
9 | | -PDF content is rendered on separate pages and uses its own page settings. |
| 22 | +Drop the **PDF Content** item from the Toolbox onto a [band](../../introduction-to-banded-reports.md) on the design surface. |
| 23 | + |
| 24 | + |
10 | 25 |
|
11 | | - |
| 26 | +## Specify PDF Content |
12 | 27 |
|
13 | | -Use one of the following options to specify PDF content: |
| 28 | +Use one of the following methods: |
14 | 29 |
|
15 | | -* [Specify PDF data](#specify-pdf-data). |
| 30 | +* [Specify binary PDF data](#specify-pdf-data) |
16 | 31 |
|
17 | 32 | This data is stored in the report file. The source of this data does not need to be available when the report is rendered. |
18 | 33 |
|
19 | | -* [Specify a reference to a PDF document](#specify-a-reference-to-a-pdf-document). |
| 34 | +* [Specify a reference to a PDF document](#specify-a-reference-to-a-pdf-document) |
20 | 35 |
|
21 | 36 | The reference to the document is stored in the report definition file. The referenced document should be available when the report is rendered. |
22 | 37 |
|
23 | | -## Add a PDF Content Control to a Report |
| 38 | +### Specify PDF Data |
24 | 39 |
|
25 | | -Drop the **PDF Content** item from the Toolbox onto a [band](../../introduction-to-banded-reports.md) on the design surface. |
| 40 | +Select the **PDF Content** control, navigate to the [Properties panel](../../report-designer-tools/ui-panels/properties-panel.md), click the **Source** property's ellipsis button, and select a PDF file. |
26 | 41 |
|
27 | | - |
| 42 | + |
28 | 43 |
|
29 | | -## Specify PDF Data |
| 44 | +When users save a report, the **Source** property value persists in the report file. |
30 | 45 |
|
31 | | -You can assign PDF data to the control's **Source** property. |
| 46 | +You can also use [report parameters](../../shape-report-data/use-report-parameters.md) to conditionally specify the **Source** property value or bind the property to a data source field. Refer to the following section for details: [Use Expressions](#use-expressions). |
32 | 47 |
|
33 | | -Expand the **PDF Content**'s smart tag and click the **Source** property's ellipsis button to obtain the binary data from a file. |
| 48 | +### Specify a Reference to a PDF Document |
34 | 49 |
|
35 | | - |
| 50 | +Select the **PDF Content** control, navigate to the [Properties panel](../../report-designer-tools/ui-panels/properties-panel.md), and assign a path to a PDF file to this property. |
36 | 51 |
|
37 | | -When users save a report, the **Source** property value persists in the report file. |
| 52 | + |
38 | 53 |
|
39 | | -> [!TIP] |
40 | | -> See the [Use Expressions](#use-expressions) section below for information on how to conditionally specify the **Source** property value, or bind it to a report parameter or data source field. |
| 54 | +You can also use [report parameters](../../shape-report-data/use-report-parameters.md) to conditionally specify the **Source Url** property value or bind the property to a data source field. Refer to the following section for details: [Use Expressions](#use-expressions). |
41 | 55 |
|
42 | | -## Specify a Reference to a PDF Document |
| 56 | +When users save a report, the URL or path specified in the **Source URL** property is included in the report file. The PDF document should be available at the specified location when a report is printed or rendered in Preview. |
43 | 57 |
|
44 | | -You can use an external PDF document as a source of PDF data. Set the **Source URL** property to a local file system path or URL. |
| 58 | +The **Source Url** property value takes precedence over the **Source** property value. If you specify both properties, **PDF Content** includes the content specified by **Source Url**. If the file specified in the **Source Url** property cannot be loaded, the PDF data from the **Source** property is used. |
45 | 59 |
|
46 | | -To specify the PDF document's location on the Web, specify the URL as the **Source URL** property's value. |
| 60 | +### Use Expressions |
47 | 61 |
|
48 | | - |
| 62 | +Select the **PDF Content** control and navigate to the [Properties panel](../../report-designer-tools/ui-panels/properties-panel.md). Click the **f** symbol right to the **Source** or **Source URL** property. |
49 | 63 |
|
50 | | -When users save a report, the URL specified in the **Source URL** property is included in the report file. The PDF document should be available at the specified location when a report is printed or rendered in Preview. |
| 64 | + |
51 | 65 |
|
52 | | -> [!TIP] |
53 | | -> See the [Use Expressions](#use-expressions) section for information on how to conditionally specify the **Source URL** property value, or bind it to a report parameter or data source field. |
| 66 | +Use the invoked **Expression Editor** to create an expression that identifies the source of a PDF file. |
54 | 67 |
|
55 | | -The **Source URL** property value takes precedence over the **Source** property value. If you specify both properties, **PDF Content** includes the content specified by **Source URL**. However, if the file specified in the **Source URL** property cannot be loaded, the binary data from the **Source** property is used. |
| 68 | +## Embed PDF File Content into a Report |
56 | 69 |
|
57 | | -## Use Expressions |
| 70 | +[Add](#add-the-pdf-content-control-to-a-report) the **PDF Content** control to a report, [specify](#specify-pdf-content) a PDF file location, and disable the control's **Generate Own Pages** property. |
58 | 71 |
|
59 | | -You can specify an expression that specifies the **Source** or **Source URL** property value. An expression can include [report parameters](../../shape-report-data/use-report-parameters.md) or [data source](../../bind-to-data.md) fields, or it can conditionally specify a property value. |
| 72 | + |
60 | 73 |
|
61 | | -Expand the **PDF Content**'s smart tag. |
| 74 | +### Use Cases |
62 | 75 |
|
63 | | -* Click the **Expression** property's ellipsis button below the **Source** property. Use the invoked **Expression Editor** to create an expression that identifies the source of binary PDF data. |
| 76 | +* Create a report with PDF file content and headers / footers that are printed on PDF file pages. |
64 | 77 |
|
65 | | -  |
| 78 | +* Print pictures, bar codes, page numbers, a report watermark, and other elements over the content of a PDF file. |
66 | 79 |
|
67 | | -* Click the **Expression** property's ellipsis button below the **Source URL** property. Use the invoked **Expression Editor** to create an expression the value of which identifies a URL or path to a PDF document. |
| 80 | +* Create a report document with paper kind that differs from PDF pages paper kind. Refer to the following section for instructions: [Fit PDF File's Page Size to Report's Page Size](#fit-pdf-files-page-size-to-reports-page-size). |
68 | 81 |
|
69 | | -  |
| 82 | +* Append PDF file content to report content and add sequential numbering to all report pages. For this, add PDF file content as a subreport to your report as described in the following section: [Fit PDF File's Page Size to Report's Page Size](#fit-pdf-files-page-size-to-reports-page-size). Then, [add page numbers](../../add-navigation/add-page-numbers.md) to both the subreport and main report. |
70 | 83 |
|
| 84 | +* Design a pre-printed form and use PDF file as a watermark. |
71 | 85 |
|
72 | | -## Limitations |
| 86 | + If your PDF file contains one page, follow the steps below: |
| 87 | + |
| 88 | + 1. Embed this page into a report's *Detail* band. |
| 89 | + 2. Remove the report's margins to prevent duplication with PDF page margins. |
| 90 | + 3. Adjust the page size to make it fit the entire *Detail* band. |
73 | 91 |
|
74 | | -* PDF content always starts on a new page. Report content is printed?on a new page after the PDF content is finished. |
| 92 | + If your PDF file contains multiple pages, do the following: |
| 93 | + * Create a subreport for each of the pages. Follow the instructions in this section: [Fit PDF File's Page Size to Report's Page Size](#fit-pdf-files-page-size-to-reports-page-size). Use the **PDF Content** control's **Page Range** property to specify the PDF file page that should be included to a subreport. |
| 94 | + * Include each of these subreports to one report. |
| 95 | + |
| 96 | +### Fit PDF File's Page Size to Report's Page Size |
| 97 | + |
| 98 | +A PDF file and a report to which you embed PDF file content might have different paper kind. PDF file pages can also be generated with double margins: page margins and report margins. |
| 99 | + |
| 100 | +This section explains how to set the same paper kind for a report and its embedded PDF file and how to include only the PDF file's page margins to the report. The main idea is to create a subreport that includes PDF pages in embedded mode, and then, add this subreport to the main report that contains initial content. |
| 101 | + |
| 102 | +1. Create a blank report. Set the report's **Paper Kind** property to the paper kind of the main report to which you want to embed PDF content. |
| 103 | + |
| 104 | +2. Drop the **PDF Content** control from the **Toolbox** onto the created report's _Detail_ band, specify a PDF file source, and disable the control's **Generate Own Pages** property. |
| 105 | + |
| 106 | +3. Remove the report's margins and adjust the **PDF Content** control size to make PDF content fit the entire *Detail* band. |
| 107 | + |
| 108 | +  |
| 109 | + |
| 110 | +4. Add the report as a subreport to your main report. Use the [Subreport](subreport.md) control with the **Generate Own Pages** property enabled. |
| 111 | + |
| 112 | +  |
| 113 | + |
| 114 | + Open the main report's Preview to show the result. |
| 115 | + |
| 116 | +## Limitations |
75 | 117 |
|
76 | 118 | * PDF content is displayed as an image in Preview. Users cannot select text in PDF content. To allow users to select text, export the report to PDF. |
77 | 119 |
|
78 | 120 | * You cannot add the **PDF Content** control to the following bands: |
79 | 121 | * **Top Margin** / **Bottom Margin** |
80 | 122 | * **Page Header** / **Page Footer** |
81 | 123 | * **Group Header** / **Group Footer** bands (if their **Repeat Every Page** properties are enabled). |
82 | | - * **Vertical Header** / **Vertical Detail** / **Vertical Total** |
| 124 | + * **Vertical Header** / **Vertical Detail** / **Vertical Total** |
0 commit comments