Jump to content
Changes to the Jaspersoft community edition download ×

Option to print without printDialog


Recommended Posts

By: Jackie Manning - jmanning

Option to print without printDialog

2001-12-04 07:11

Great work!

 

We are trying to replace Crystal Reports with a java report writer in our application and JasperReports is looking very good. So far, Subreports look like the only missing piece that we need.

 

In my app we will be printing batches of reports, always to the default printer. Having the printDialog popup for each report is not really practical. I have commented out the

"if (printJob.printDialog())"

statement in the JRPrinter.printPages method and it works perfectly. How about adding a printDefault method or a printPages method/methods with a boolean argument option to show/not show the printDialog?

 

Thanks again

 

 

 

 

By: Jackie Manning - jmanning

RE: Option to print without printDialog

2001-12-04 07:12

By the way, I would be happy to do this myself and send you the changes.

 

 

 

 

 

 

 

By: Teodor Danciu - teodord

RE: Option to print without printDialog

2001-12-04 22:59

 

Hi,

 

You are perfectly right !

I'm sure many users will want to bypass

the print dialog window.

In the future version I will provide a way

to avoid displaying this window.

 

Thanks,

Teodor

 

 

 

 

 

By: Tony Kay - tkay

RE: Option to print without printDialog

2003-04-04 03:23

As far as I have found out, there are two ways now to print a Report:

- Print it to the default printer

- Print it to a printer selected by the user (PrintDialog)

 

I would need one more option, to pass the printer to Jasper. Something like JasperPrintManager.printReport ("reportname","\serverprintername");

 

Is something like this available?

 

thx, Tony

 

 

 

 

By: Teodor Danciu - teodord

RE: Option to print without printDialog

2003-04-04 08:05

 

Hi,

 

If you are using JDK1.4, you can print to a specific

network printer with the Java Print Service API.

There is a sample "printservice" provided with

JasperReports that shows hot to use the

JRPrintServiceExporter.

 

Thank you,

Teodor

 

 

 

 

 

By: juan david vergara perez - jvergara

RE: Option to print without printDialog

2003-04-07 12:12

i've got another idea.

 

The pdf exporter manipules an PdfWriter Object. You can add javascript code to pdf format using this pdfwriter.

 

in this way the follow line prints the document in the printer default,

 

PdfAction jAction = PdfAction.javaScript("this.print(false, 0, this.numPages-1, true);r", pdfWriter);

pdfWriter.addJavaScript(jAction);

 

and the next line shows the printDialog box

 

PdfAction jAction = PdfAction.javaScript("this.print(true, 0, this.numPages-1, true);r", pdfWriter);

pdfWriter.addJavaScript(jAction);

 

 

 

 

 

By: juan david vergara perez - jvergara

RE: Option to print without printDialog

2003-04-07 13:15

i've got another idea.

 

The pdf exporter manipules an PdfWriter Object. You can add javascript code to pdf format using this pdfwriter.

 

in this way the follow line prints the document in the printer default,

 

PdfAction jAction = PdfAction.javaScript("this.print(false, 0, this.numPages-1, true);r", pdfWriter);

pdfWriter.addJavaScript(jAction);

 

and the next line shows the printDialog box

 

PdfAction jAction = PdfAction.javaScript("this.print(true, 0, this.numPages-1, true);r", pdfWriter);

pdfWriter.addJavaScript(jAction);

 

 

 

 

 

By: Tony Kay - tkay

RE: Option to print without printDialog

2003-04-10 03:00

Thanks, Theodor. Your solution was exactly what I needed.

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...