Skip to Content
avatar image
Former Member

When running a standalone java program, export to pdf hangs, how can I troubleshoot

I have a Windows 2008 R2 server on which CRystal Reports 2008 is alreday installed. I can go in designer and can run a crystal report and export to a pdf file.

I, however, want to do it from a standalone java program.

When running java program I can trace that I successfully opened the report and report has made database connection, but then my program gets hung at BytesArrayInputStream line.... I have no clue how can troubleshoot the problem. Any pointers will be helpful. I am attaching the java file as well as the .bat file used.testexportbat.txtreportexportjava.txt

System.out.println("before bytestream");

ByteArrayInputStream bais = (ByteArrayInputStream) clientDoc.getPrintOutputController().export(ReportExportFormat.PDF);

int size = bais.available(); System.out.println("size = " + size);

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Dec 17, 2018 at 11:40 PM

    As of XI 3.1 SP4 - the following code will not work:

    ByteArrayInputStream byteArrayInputStream = (ByteArrayInputStream)rcd.getPrintOutputController().export(ReportExportFormat.PDF);

    Instead you need to use:

    InputStream inputStream = rcd.getPrintOutputController().export(ReportExportFormat.PDF);

    You can then use the inputstream object to write to a file or browser.

    Shawn

    Add comment
    10|10000 characters needed characters exceeded