Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How to generate PDF report directly instead of RPT report by using JRC ?

Hi,

Good Day !

How to generate PDF report directly instead of RPT report by using Crystal Reports XI Release 2 Java Reporting Component (JRC) in desktop (Swing thick-client) ?

My GUI program will generate a RPT report, then i can export to PDF file, this is ok, no problem.

BUT

i want it direct to generate a PDF report, not a RPT report.

The code like below (2 java files)

ClassA.java

:

:

ReportClientDocument reportClientDoc = new ReportClientDocument();

reportClientDoc.open(XXX, 0);

ParameterFieldController paramFieldController = reportClientDoc.getDataDefController().getParameterFieldController();

paramFieldController.setCurrentValue("", "XXX", DomainClass.getXXX());

new ReportViewerFrame(reportClientDoc);

:

:

// End of ClassA.java

// Begin ReportViewerFrame.java

public class ReportViewerFrame extends JFrame

:

:

//Initial window frame properties.

private final int XPOS = 80;

private final int YPOS = 60;

private final int WIDTH = 760;

private final int HEIGHT = 550;

private ReportViewerBean reportViewer = new ReportViewerBean();

private ReportClientDocument reportClientDoc = new ReportClientDocument();

public ReportViewerFrame(ReportClientDocument reportClientDoc) throws Exception

{

//Initialize frame properties.

this.setResizable(true);

this.setLocation(XPOS, YPOS);

this.setSize(WIDTH, HEIGHT);

this.setTitle("Crystal Report Java Viewer");

//Add GUI components to the frame including the ReportViewerBean.

addComponents();

//Add GUI listeners to the frame.

addListeners();

//Set the report that the ReportViewerBean will display.

this.reportClientDoc = reportClientDoc;

reportViewer.setReportSource(reportClientDoc.getReportSource());

reportViewer.init();

reportViewer.start();

//Display the frame.

this.setVisible(true);

}

How to set the export option to PDF base on existing code ?

Where can i download this package/jar ?

regards

Former Member
Not what you were looking for? View more on this topic or Ask a question