Jump to content
Changes to the Jaspersoft community edition download ×

Landscape and Portrait layout in same report

Recommended Posts

Is this possible? I have seen on the forumns that people were unable to do it unless they used a tool in iText to merge the pages, but with page numbering this really isn't a good way to do it.


My context is that my report is of a known format...


Page 1 : (Portrait) covering letter

Page 2 : (Portrait) summary page (user details summary, not data summary)

Page 3, 4, etc: (Portrait) "Dynamic data in detail section

Page n: (Landscape) Final summary page, in landscape (this page has to be in landscape, will not fit in portrait in asthetic fashion). Has a chart or two and some images etc.


I am hoping that there is an easy way to have the required pages be in alternating orientations without having to use an external tool. The report is integrated into a website using a hibernate datasource and I am hoping to avoid having any overhead or extra work incurred outside the report (i.e. needing to use iText to merge documents etc)


Any comments on this issue are appreciated (including the best workarounds possible should it not be possible).




Link to comment
Share on other sites

  • Replies 9
  • Created
  • Last Reply

Top Posters In This Topic

I'm having the same exact problem. Looking around I found this on the forums...


By: jj1978 - jj1978

RE: Using portrait and landscape in single report

2006-05-21 18:18

Yes it is possible!


eg: My report page 1 (jr1) is portrait and page 2 (jr2) landscape.


JasperReport jr1 = (JasperReport)JRLoader.loadObject( ... );

JasperReport jr2 = (JasperReport)JRLoader.loadObject( .... );


JREmptyDataSource ds = new JREmptyDataSource( 1 );


JasperPrint print1 = JasperFillManager.fillReport( jr1, new HashMap(), ds );


JasperPrint print2 = JasperFillManager.fillReport( jr2, new HashMap(), ds );

List l = new ArrayList();

l.add( print1 );

l.add( print2 );

JRPdfExporter exp = new JRPdfExporter();

exp.setParameter ( JRExporterParameter.JASPER_PRINT_LIST, l );

exp.setParameter(JRExporterParameter.OUTPUT_FILE_NAME, SAVE_LOCATION );



I cannot seem to get this to work with JRPrintServiceExporter as of yet for actual printing (it prints only the first jasperReport, then fails to print the rest in the list), however you might have some luck with it.


If you find another solution or someone can help it would be much appreciated. Thanks.

Link to comment
Share on other sites

  • 2 weeks later...

Thanks Teodor!

To achieve multiple page layouts for reports I did 2 different methods..

1. No Post Editing Was Needed:
Used pure jasper, as described above:


2. Post Editing Required:
-e.g. To add page numbering in header.
-Used iText
) wrote a program to merge the pages and manually insert page numbering on the pages.


Incidentally Teodor/Lucian, is this type of functionality on the horizon for jasper reports?





Link to comment
Share on other sites

To add some more complexity to this issue, I am integrating this report into an AppFuse/Spring framework. To achieve this integration I am thinking I will need to create a custom Spring JasperReportsPdfView which will do the manual merging of the pdf file into an output stream to be returned to the browser for download. Has anyone ever done anything similar?



Lucian/Teodor any word on having portrait and landscape pages in PDF and other exporters is going to make it into a release of Jasper anytime soon?




Link to comment
Share on other sites

  • 1 year later...

also, has anyone tried to interleave portrait and landscape pages - for example, if i have a report with 2 pages, one to be printed in portrait mode and the other in landscape mode - and the query returns N rows - for my design, its printing N portrait pages forllowed by N landscaped pages.

I wanna print interleaving portrait/landscaped pages thats easy when an end user prints the report. One way lucian suggested is to write my own exporter - which i dont have time for at this moment.

any other suggestions lucian?


thanks in advance.

Link to comment
Share on other sites

  • 1 year later...



It would be greate if you could log a request for enhancement on the project trackers. This would allow us to refine the requirement and come up with a solution that suits more people.

Please give as many real-world use case scenarios as possible, so that we better understand this need of having variable page layout and size, inside a document.


Why is that the batch exporter functionality already existing in JR is not enough?


Thank you,



Link to comment
Share on other sites

  • 1 year later...

Hi Lucian/Tedor,

As you said, this was the only solution to have mixed orientation report. I did the implementation as suggetsed here and get the report as expected in PDF format.

But when I tried the same using JRRtfExporter, I come across one issue. Although the data and formatting was exported successfully, but when I opened the report using Word, all the pages were in Portrait orientation.

If I manually changed the orientation of the particular page, reports looks fine with desired orientation. But as this can not be expected from the end user, can you give any suggestion to have correct output while using RTF export.

As requirement is very urgent, any help is higly appreiciated.


Link to comment
Share on other sites

  • 8 years later...

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