Jump to content
We've recently updated our Privacy Statement, available here ×

Generate one pdf per page with jasper report


brcg.it

Recommended Posts

(Using Jaspersoft Studio 6.6.0, no Jasper Server yet) My dataset looks like this

id|question1|question2|question3
1 |answer1.1|answer1.2|answer1.3
8 |answer8.1|answer8.2|answer8.3

The report is designed to show one row per page

Page 1:
<------- Header-------->
<--------ID:1---------->
Question 1:
[answer1.1]

Question 2:
[answer1.2]

Question 3:
[answer1.3]
<-------Footer------->

Page 2:
<------- Header-------->
<--------ID:8---------->
Question 1:
[answer8.1]

Question 2:
[answer8.2]

Question 3:
[answer8.3]
<-------Footer------->

If i generate the report as PDF, i get one PDF with as many pages as there are rows.

But what i need would be to have as many seperate PDF files as there are rows. Is this possible?
 

Link to comment
Share on other sites

  • Replies 2
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

I guess you will have to use JasperReports API for that after generating the filled report (JRPrint-Object).

So the JRExporter has an flag just to export certain pages. So you could read the size of the generated JasperPrintPages and call the JRExporter for each generated JasperPrintPage separately with the current PAGE_INDEX for each single page.

But keep in mind, that for example some streching content could also cause to generate multiple pages even for just one single database record.... so not sure if your report really generates just one page per row/record.. it depend's at your data & report design of course!

hth + regards

C-Box

Link to comment
Share on other sites

This PAGE_INDEX parameter can be used with JasperReports API directly, as C-Box said.

If you are using Jaspersoft Studio, you could set this parameter by clicking on Report Parameters icon in the Parameters section of the Preview area (see attachment image)

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