Jump to content
JasperReports Library 7.0 is now available ×

Print preview of an already written .pdf file


imanol00

Recommended Posts

Hello forum users!!

 

I made a big and complex report from two little reports. What I want to know is that if I can make a print preview of this.

 

I mean, with a simple report, I can pass a JasperPrint object as parameter to JasperViewer.viewReport(), but, in this case, I have two JasperPrint objects.

 

There is an implementation of JasperViewer.viewReport() that takes as first parameter a String, but it doesn't work.

 

Anybody can help me?

 

Thanks a lot

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

If I understand correctly, you want to use the existing JRViewer to display two reports as being only one.

The only solution I could think of is to merge the two separate JasperPrint objects into one.

This could be achieved by copying pages from one document into the other.

Besides pages, I think report-level styles should also be copied.

Did not try this lately, but maybe you could give it a try and let us know.

 

Thank you,

Teodor

Link to comment
Share on other sites

Hello Teodor.

 

Thanks for your help, but I solved my problem in a different way. I think it's an uglier way, but I don't care.

 

What I did is merging the two subreports by doing a loop in my Java program and feeding both subreports with the data several times.

 

All the reports generated are enqueued in a list, and finally I pass this list to a JrPdfExporter as a parameter and voila! I got what I wanted: a report with portrait and landscape pages alternated.

 

Maybe I'll send it just to be the Report of the Month...hehe

 

Thanks for this powerful library!!

Link to comment
Share on other sites

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...