This content has been marked as final. Show 11 replies
The Acrobat SDK has details on the supported interfaces to Acrobat
(this isn't one of them). A few of them work with the free Reader too.
Command lines were declared obsolete by Microsoft around 1992.
Thanks very much! Aandi Inston.
So I think I need to study Acrobat SDK or find another method to resolve this problem.
> Command lines were declared obsolete by Microsoft around 1992.
Fortunately, no one paid much attention, and the *nix guys simply chuckled.
I use a JAVA program to create a PDF file and then just want to send the generated file to printer to print. That's all. I'm trying to find an easy way to achieve this request.
Dear all, now I use Jasperreport to generate the PDF file and then send it to printer.
Just update to you.
Thanks for you help!
I am also using JasperReports and I have the same problem, I am developing a web application and I generate a report in a servlet. How can I send it directly to the client's default printer, without showing it?
I am sorry if this is offtopic,
> How can I send it directly to the client's default printer, without showing it?
You can't. This would be considered a very bad thing.
Imagine if you visited a web site and the advertisers could choose to
start printing their adverts!
My program is a desktop application, no a web application. It's not the same as you. And hope the following codes can help you :)
private void exportReportToPrinter(JasperPrint jasperPrint,int copyNum, String printerName, MediaSizeName mediaSizeName) throws Exception
// create the print service exporter so that we can print to a named
JRPrintServiceExporter exporter = new JRPrintServiceExporter();
// set the report to print
// tell the exporter to print 1 copy on A4 paper
PrintRequestAttributeSet aset = new HashPrintRequestAttributeSet();
// let the exporter know which printer we want to print on
PrintServiceAttributeSet serviceAttributeSet = new HashPrintServiceAttributeSet();
serviceAttributeSet.add(new PrinterName(printerName, null));
// print it
Thanks for the code, Muiz! I don't know if I can use this in my web app but I've already accepted this as 'not possible' so if I manage to do any progress - good for me! :) Thanks again!
Pedja, you're welcome!
What if what is intended to print some other pdf file instead of a report generated from Jasper?
Calling programs thru command-line arguments cannot be deprecated because is the simplest platform-independent way to call other programs.
When I use Acroread32.exe /t file.pdf <UNCName> <printServName>, I send the command by another process that calls Runtime.getRuntime().exec(strExecution). The problem is that if I run the program, an Reader display shows to me (which is unnecessary), and if another app is calling this sentence, an Acro32.exe process is started upon Task Manager but it hangs-up, and remains "zombie". The printjob never completes.
Please any help will be appreciated. Thank you very much.