Skip to Content
author's profile photo Former Member
Former Member

Problem with printing a PDF

Hi All,

I'm developing a web application written in J2EE that uses Java Reporting Component (JRC) to display crystal reports from some filters recovered from a jsp and passed to a report .rpt previously designed and invoked just at runtime.

I have a problem with printing a PDF:

I want, after entering the filters in a jsp, to print a report in PDF format (WORD) without opening it

with Adobe Reader (Microsoft Word). The class of API JRC used for export is ReportExportControl.

Can anyone help me?

I wish a great day to You all.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Mar 25, 2009 at 08:03 PM

    Which JRC version are you using?

    CR XI R2 supports server side printing and client side export.



    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Ted Ueda

      Hi Ted Ueda,

      sorry for the delay of my answer.

      I understand very well the problems related to security.

      With the following code that I used to produce a report (PDF) at runtime,

      is the PDF created on the server and then sent to the client, or is it directly created on the client as PDF

      from RTF previously realized?

      ReportExportControl exportControl = new ReportExportControl();

      String report = report path;

      ReportClientDocument reportClientDoc = new ReportClientDocument();, OpenReportOptions._openAsReadOnly);

      Object reportSource = null;

      reportSource = reportClientDoc.getReportSource();

      //The method setConnectionProperties() stores all the connection parameters in the collection


      ConnectionInfos connInfos = setConnectionProperties(request, reportClientDoc);





      //Single method to pass parameters to Crystal Reports. Using classes ParameterFieldController and


      setReportParametersValue(reportClientDoc, reportParameters, subReportParameters);

      ExportOptions exportOptions = new ExportOptions();

      //Set the export format (PDF)


      PDFExportFormatOptions PDFExpOpts = new PDFExportFormatOptions();




      try {

      exportControl.getHtmlContent(request, response, getServletConfig().getServletContext());

      } catch (ReportSDKExceptionBase e) {

      throw new ApplicationException("error code", ": error message"); }

      As, however, I predicted in my previous message about the direct printing on the client,

      I read about ActiveX, but I don't know how to use them.

      I read this information in the 'Crystal Reports for Eclipse Developer Guide' about "printMode" attribute:

      "In ActiveX print mode, an ActiveX control is downloaded to the client machine and the report is send directly to the printer...."

      The ActiveX alternative is a java applet that runs on the client and takes the pdf from the server and prints directly onto the clients through the commands that I used in the DOS command line:

      1) AcroRd32.exe /p /h FILENAME


      /p = print

      /h = hide window

      to print the report and

      2) tkill AcroRd32

      to close Adobe Reader, because it doesn't end automatically after printing and the command /h is used just to minimize the process.

      I hope you can give me advice because I need to print directly on the client. Thank you

  • Posted on Oct 27, 2009 at 08:51 PM

    As Ted indicated this would be a major security issue. You are basically asking your users to give full access to all external applications to execute programs locally. No one would or should ever allow this to happen. That's how virus's and trojans are sent around.

    One option is for you to set your local printer to a file and send that PRN file to them so they can simply send the PRN file to the local printer using Batch file or something similar.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.