Skip to Content

How to print Landscape report on custom paper size with Crystal java runtime

I have my own Java application which uses Crystal java runtime. I print crystal report in following way:

reportClientDoc.getPrintOutputController().printReport( printOptions );

I use custom paper size 101.6x152.4 mm so I set in printOptions. Printer (Zebra S4M 203) does not print any report, report appears in Windows spool and dissappear.

I have tested A4 and A3 paper sizes and both work correctly because I can set PaperSize.paperA4 or PaperSize.paperA5. I can not print landscape report when I use custom paper size.

I have tried multiple configurations.

I tried to set UserPaperSize in twips

PrintOutputController printCntrl = reportClientDoc.getPrintOutputController();

PaperOrientation paperOrientation = printCntrl.getPrintOptions().getPaperOrientation();

if( paperOrientation.equals( PaperOrientation.landscape ) )
    printCntrl.modifyUserPaperSize( x_twips, y_twips );
    printCntrl.modifyUserPaperSize( y_twips, x_twips );

I tried to check and uncheck "Dissociate Formatting Page Size and Printer Paper Size" checkbox in Page Setup.

My reports is printed correctly from Crystal Reports application but I cannot print landscape report from my application which uses Crystal Java runtime.

How to print landscape report on custom paper size with Crystal Java runtime?

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Dec 17, 2018 at 09:58 PM

    Hi there,

    There are three things I would suggest trying for this:

    1. boReportClientDocument.getPrintOutputController().modifyUserPaperSize(50000, 50000); (You are already doing this - so keep this in)

    2. Make sure that the printer is exposed to the JVM. ( If the printer doesn't show up in the list -that may be why setting the custom papersize is not working.

    3. Try displaying in the crystalreportviewer. It can handle any custom papersize. This will help you verify if the papersize is being set correctly.


    Add comment
    10|10000 characters needed characters exceeded