Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Jasper Reports - How to manage multiple pages / insert page breaks

3,468 views
Skip to first unread message

Niall Murphy

unread,
Oct 11, 2004, 9:40:50 AM10/11/04
to
Hi all,

I'm using jasper reports to create a PDF document dynamically from a
java application. However the PDF document I want to create is quite
long - 10 pages and contains lots of static text.

I've hit a problem when it comes to managing to design the PDF
documents to be over one page in length ... is there a way to insert
page breaks or format the document over several pages. Are there xml
tags that can be used ? Could subreports or some other method be used
?

I'm also using iReport designer alongside Jasper Reports but haven't
seen how to manage multiple page documents in that tool either.

If anyone can help with this query I'd really appreciate it.

Thanks,
Niall.

Pavel L.Yatsuk

unread,
Oct 12, 2004, 6:53:24 AM10/12/04
to
Hello!
Very easy
Each page in report is separated report
for example
i create 3 report with static text
then i fill this report with data and receive 3 files with extention
*.jrprint
In end i gather this files in one pdf file

for filling report with data

String sourceFileName = "file.jasper";
String printFile="file.jrprint";
JasperFillManager.fillReportToFile(sourceFileName,printFile,params,
dataSources);

for gathering files in one report

for (Iterator iter = reportFiles.iterator(); iter.hasNext();) {
String fileName = (String) iter.next();
try {
printList.add(JRLoader.loadObject("file.jrprint"));
} catch (JRException e1) {
e1.printStackTrace();
}
}
JRPdfExporter exporter=new JRPdfExporter();
exporter.setParameter(JRExporterParameter.JASPER_PRINT_LIST,
printList);
exporter.setParameter(JRExporterParameter.OUTPUT_FILE_NAME,
destFileName);
try {
exporter.exportReport();
} catch (JRException e) {
e.printStackTrace();

0 new messages