|
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: |
8 | 9 |
|
9 | | -PDF content is rendered on separate pages and uses its own page settings. |
| 10 | +* *Default*. Render each PDF file page as a separate report page. |
| 11 | + |
| 12 | +  |
10 | 13 |
|
11 | | - |
| 14 | +* Embed PDF content into a report. |
12 | 15 |
|
13 | | -Use one of the following options to specify PDF content: |
| 16 | +  |
14 | 17 |
|
15 | | -* [Specify PDF data](#specify-pdf-data). |
| 18 | + Refer to the following documentation section for more details: [Embed PDF File Content into a Report](#embed-pdf-file-content-into-a-report). |
16 | 19 |
|
17 | | - This data is stored in the report file. The source of this data does not need to be available when the report is rendered. |
| 20 | +## Add the PDF Content Control to a Report |
18 | 21 |
|
19 | | -* [Specify a reference to a PDF document](#specify-a-reference-to-a-pdf-document). |
| 22 | +Drop the **PDF Content** item from the Toolbox onto a [band](../../introduction-to-banded-reports.md) on the design surface. |
20 | 23 |
|
21 | | - The reference to the document is stored in the report definition file. The referenced document should be available when the report is rendered. |
| 24 | + |
22 | 25 |
|
23 | | -## Add a PDF Content Control to a Report |
| 26 | +You can also copy a PDF document from an external application and paste it in your report, or drag a document and drop it onto the design surface. |
24 | 27 |
|
25 | | -Drop the **PDF Content** item from the Toolbox onto a [band](../../introduction-to-banded-reports.md) on the design surface. |
| 28 | + |
| 29 | + |
| 30 | +The dragged file's content is assigned to the control's **Source** property as [binary data](#specify-pdf-data). |
26 | 31 |
|
27 | | - |
| 32 | +## Specify PDF Content |
28 | 33 |
|
29 | | -You can also copy a PDF document from an external application and paste it in your report, or drag a document and drop it onto the design surface. The dragged file's content is assigned to the control's **Source** property as [PDF data](#specify-pdf-data). |
| 34 | +Use one of the following methods: |
30 | 35 |
|
31 | | - |
| 36 | +* [Specify binary PDF data](#specify-pdf-data) |
32 | 37 |
|
33 | | -## Specify PDF Data |
| 38 | + This data is stored in the report file. The source of this data does not need to be available when the report is rendered. |
34 | 39 |
|
35 | | -You can assign PDF data to the control's **Source** property. |
| 40 | +* [Specify a reference to a PDF document](#specify-a-reference-to-a-pdf-document) |
36 | 41 |
|
37 | | -Expand the **PDF Content**'s smart tag and click the **Source** property's ellipsis button to obtain the binary data from a file. |
| 42 | + The reference to the document is stored in the report definition file. The referenced document should be available when the report is rendered. |
38 | 43 |
|
39 | | - |
| 44 | +### Specify PDF Data |
| 45 | + |
| 46 | +Expand the **PDF Content** control's smart tag, click the **Source** property's ellipsis button, and select a PDF file. |
| 47 | + |
| 48 | + |
40 | 49 |
|
41 | 50 | When users save a report, the **Source** property value persists in the report file. |
42 | 51 |
|
43 | | -> [!TIP] |
44 | | -> 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. |
| 52 | +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). |
45 | 53 |
|
46 | | -## Specify a Reference to a PDF Document |
| 54 | +### Specify a Reference to a PDF Document |
47 | 55 |
|
48 | | -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. |
| 56 | +Expand the **PDF Content** control's smart tag, click the **Source URL** property's ellipsis button, and select a PDF file. |
49 | 57 |
|
50 | | -Expand the **PDF Content**'s smart tag and click the **Source URL** property's ellipsis button to specify the PDF document location in the file system. |
| 58 | + |
51 | 59 |
|
52 | | - |
| 60 | +To specify a PDF document location on the Web, assign a document URL to the **Source URL** property. |
53 | 61 |
|
54 | | -To specify the PDF document's location on the Web, use the URL as the **Source URL** property's value. |
| 62 | + |
55 | 63 |
|
56 | | - |
| 64 | +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). |
57 | 65 |
|
58 | 66 | 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. |
59 | 67 |
|
60 | | -> [!TIP] |
61 | | -> 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. |
| 68 | +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. |
62 | 69 |
|
63 | | -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. |
| 70 | +### Use Expressions |
64 | 71 |
|
65 | | -## Use Expressions |
| 72 | +Expand the **PDF Content** control's smart tag and click the **Expression** property's ellipsis button below the **Source** or **Source URL** property. |
66 | 73 |
|
67 | | -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. |
| 74 | + |
68 | 75 |
|
69 | | -Expand the **PDF Content**'s smart tag. |
| 76 | +Use the invoked **Expression Editor** to create an expression that identifies the source of a PDF file. |
70 | 77 |
|
71 | | -* 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. |
| 78 | +## Embed PDF File Content into a Report |
72 | 79 |
|
73 | | -  |
| 80 | +[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. |
74 | 81 |
|
75 | | -* 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. |
| 82 | + |
76 | 83 |
|
77 | | -  |
| 84 | +### Use Cases |
78 | 85 |
|
| 86 | +* Create a report with PDF file content and headers / footers that are printed on PDF file pages. |
79 | 87 |
|
80 | | -## Limitations |
| 88 | +* Print pictures, bar codes, page numbers, a report watermark, and other elements over the content of a PDF file. |
| 89 | + |
| 90 | +* 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). |
| 91 | + |
| 92 | +* 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. |
| 93 | + |
| 94 | +* Design a pre-printed form and use PDF file as a watermark. |
| 95 | + |
| 96 | + If your PDF file contains one page, follow the steps below: |
| 97 | + 1. Embed this page into a report's *Detail* band. |
| 98 | + 2. Remove the report's margins to prevent duplication with PDF page margins. |
| 99 | + 3. Adjust the page size to make it fit the entire *Detail* band. |
81 | 100 |
|
82 | | -* PDF content always starts on a new page. Report content is printed?on a new page after the PDF content is finished. |
| 101 | + If your PDF file contains multiple pages, do the following: |
| 102 | + 1. 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. |
| 103 | + 2. Include each of these subreports to one report. |
| 104 | + |
| 105 | +### Fit PDF File's Page Size to Report's Page Size |
| 106 | + |
| 107 | +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. |
| 108 | + |
| 109 | +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. |
| 110 | + |
| 111 | +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. |
| 112 | + |
| 113 | +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. |
| 114 | + |
| 115 | +  |
| 116 | + |
| 117 | +3. Remove the report's margins and adjust the **PDF Content** control size to make PDF content fit the entire *Detail* band. |
| 118 | + |
| 119 | +  |
| 120 | + |
| 121 | +4. Add the report as a subreport to your main report. Use the [Subreport](subreport.md) control with the **Generate Own Pages** property enabled. |
| 122 | + |
| 123 | +  |
| 124 | + |
| 125 | + The following image demonstrates the main report's Preview: |
| 126 | + |
| 127 | +  |
| 128 | + |
| 129 | +## Limitations |
83 | 130 |
|
84 | 131 | * 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. |
85 | 132 |
|
|
0 commit comments