To PDF
To export the results of a report to PDF file, follow the steps below:
- In JReport Designer, open the web report or the report tab in a page report that you want to export.
- Click File > Export To > PDF.
- In the Export to PDF dialog, specify the settings as required. See the dialog.
- When done, click OK to generate the file.
See also Export to PDF dialog for detailed explanation about options in this dialog.
The following example shows how to export the results of a report to PDF format and view the exported result file, taking the sample report CustomerAnalysis.cls in SampleReports.cat as an example:
- Click File > Open on the menu bar.
- In the Open Report dialog, click the Browse button to open the catalog file SampleReports.cat in
<install_root>\Demo\Reports\SampleReports
, then open CustomerAnalysis.cls in the catalog.
- Click File > Export To > PDF to open the Export to PDF dialog.
- Specify the path where the files will be exported and the file name as required. Here we use the default path
C:\JReport\Designer\Demo\Reports\SampleReports\
and default name CustomerAnalysis_CustomerAnalysis.pdf.
- Make sure that TOC, Drilldown and Generate charts and barcodes using vector graphics are checked.
- Check the Encrypt option to set the document open password and permissions password in the Encrypt dialog. See the dialog.
- Check the Sign option to set a digital ID for the PDF file in the Sign Digital ID dialog. See the dialog.
- Check Run Linked Report if you want to include the linked reports in the exported PDF result.
- When done, click OK to generate the files.
- Open the directory
C:\JReport\Designer\Demo\Reports\SampleReports\
and fine the exported files.
- Open the file CustomerAnalysis_CustomerAnalysis.pdf with the inputted document open password or permissions password using the Adobe Acrobat software.
- The Table of Contents (TOC) is displayed in the left Bookmarks panel, and includes the names of both groups and subgroups. If you click a group, the contents will be shown in the right pane.
- The signature is displayed in the left Security Settings panel, and all information you set can be found there.
- Place the mouse pointer over a summary field. When it becomes a hand, click to view the details of the summary.
Note that summaries should be inserted into the report in advance. They cannot be hidden or suppressed; otherwise you will not be able to get the drill-down files.
Also, since the option Generate charts and barcodes using vector graphics is checked when exporting the report, when zooming in the chart, you will find that the chart is a vector graphic which never distorts.
Notes:
- If you check Compress Image in the Export to PDF dialog, the transparent image will be compressed, but the transparent attribute will be ignored.
- JReport stores the finished pages in RAM before the pages are finally written to a PDF file. When the result file is too large, you may find that you are low on RAM, leading to an OutOfMemoryError. You can solve this problem by changing the maximum heap size (-Xmx100m). Also, you can use the old method (Simulated Printing).
- If the color mode of your display adapter is less than 256 colors, when you export to PDF file using the standard method, charts cannot be compressed. This is because JReport catches an image with less than 256 colors as a GIF image. A GIF image cannot be compressed.
- When you export a report which has summary fields, if the Drill Down checkbox is checked, every summary field in this report will generate a new file which is linked in the main file.
- In the Sign Digital ID dialog, by default, the information of Digital ID File and Password are checked. If there are any problems, the error messages will prompt you, such as Unable to import the chosen Digital ID file! or Incorrect password! and so on.
- Before exporting a page report tab or a web report using true type fonts, you should select the report tab name or the web report in the Report Inspector, and then set Embedded Fonts equal to all true type fonts that you have used in the report tab or web report. Otherwise the PDF files may not be displayed correctly.
- When you export a web control object, barcode or UDO to PDF, if you select Generate charts and barcodes using vector graphics, the results will be the vector graphic; if you select the Generate charts and barcodes using images, the results will be the bitmap.
- When a report, in which there is an object beyond its container, is exported to PDF, the overstepped part will be ignored in PDF file, but the overstepped part of objects in a paragraph can still be exported to PDF.
- In order to get a better effect, Acrobat Reader 6.0 is recommended.