on 02-08-2012 7:44 PM
I have a thick java report viewer that I would like to print from programmatically. I tried using ReportViewerBean.printView(), which works, but I would rather not get the Windows printer popup and print directly to the default printer.
Can this be done?
I figured it out. I was trying to print before the report was finished loading. I added a "wait" loop and everything works. Thanks again for the help!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for the response. I tried something similar and it now prints but for some reason I am getting a thread trace in the console and a popup with the same trace. Any ideas?
PrintService defaultPrinter = PrintServiceLookup.lookupDefaultPrintService();
PrintOutputController print = reportWorker.getReportClientDocument().getPrintOutputController();
PrintReportOptions options = new PrintReportOptions();
options.setNumberOfCopies(1);
options.setPrinterName(defaultPrinter.getName());
print.printReport(options);
The message is displayed in a: com.crystaldecisions.Utilities.MessageBox
active-thread call stack:
~com.crystaldecisions.reports.formatter.export2.ExportSupervisorEx.a(SourceFile:578)
~com.businessobjects.reports.sdk.requesthandler.ReportViewingRequestHandler.l(SourceFile:824)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter.do(SourceFile:2037)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter.if(SourceFile:661)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter.a(SourceFile:167)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.a(SourceFile:529)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter$2.call(SourceFile:527)
~com.crystaldecisions.reports.common.ThreadGuard.syncExecute(SourceFile:102)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter.for(SourceFile:525)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter.int(SourceFile:424)
~com.businessobjects.reports.sdk.JRCCommunicationAdapter.request(SourceFile:352)
~com.businessobjects.sdk.erom.jrc.a.a(SourceFile:54)
~com.businessobjects.sdk.erom.jrc.a.execute(SourceFile:67)
~com.crystaldecisions.proxy.remoteagent.RemoteAgent$a.execute(SourceFile:716)
~com.crystaldecisions.proxy.remoteagent.CommunicationChannel.a(SourceFile:125)
~com.crystaldecisions.proxy.remoteagent.RemoteAgent.a(SourceFile:537)
~com.crystaldecisions.sdk.occa.report.application.ds.a(SourceFile:186)
~com.crystaldecisions.sdk.occa.report.application.ReportSource.a(SourceFile:1558)
~com.crystaldecisions.sdk.occa.report.application.ReportSource.getServerCapabilities(SourceFile:1842)
~com.businessobjects.crystalreports.viewer.core.rs.RSReportChannel.int(Unknown Source)
~com.businessobjects.crystalreports.viewer.core.rs.RSReportChannel.<init>(Unknown Source)
~com.businessobjects.crystalreports.viewer.core.rs.RSReportChannelFactory.newReportChannel(Unknown Source)
~com.businessobjects.crystalreports.viewer.core.ReportChannel.getReportChannel(Unknown Source)
~com.businessobjects.crystalreports.printer.bean.Printer.int(Unknown Source)
~com.businessobjects.crystalreports.printer.bean.Printer.int(Unknown Source)
~com.businessobjects.crystalreports.printer.bean.ReportPrinter.setReportSource(Unknown Source)
~com.crystaldecisions.sdk.occa.report.application.PrintOutputController.g(SourceFile:807)
~com.crystaldecisions.sdk.occa.report.application.PrintOutputController.printReport(SourceFile:735)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Could you try the below code snippet:
Retrieve the IReportPrinterOptions Interface from the report objects
IReportPrinterOptions PrinterOptions = oReport.getReportPrinterOptions();
printerOptions = setEnabled(true);
String printerName = XYZ; // Set the printer name
PrinterOptions.setPrinterName(printerName);
printerOptions.setCopies(1);
Let me know if this works
Regards,
Rameez Shaikh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
96 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 | |
4 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.