Jump to content
Changes to the Jaspersoft community edition download ×

pdf has no pages

Recommended Posts

By: ainhoa - sorgin

pdf has no pages

2003-05-22 01:02



I try to get a pdf report, if a write it in the disk the report is perfect, but if I try to export it to a Stream, y get this error:

ExceptionConverter: java.io.IOException: The document has no pages. at com.lowagie.text.pdf.PdfPages.writePageTree(Unknown Source) at com.lowagie.text.pdf.PdfWriter.close(Unknown Source) at com.lowagie.text.pdf.PdfDocument.close(Unknown Source) at com.lowagie.text.Document.close(Unknown Source) at dori.jasper.engine.export.JRPdfExporter.exportReportToStream(JRPdfExporter.java:345) at dori.jasper.engine.export.JRPdfExporter.exportReport(JRPdfExporter.java:262) at servlets.PdfServlet.service(PdfServlet.java:52) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at ...


This is the code, but I have try is with several methods:


ServletContext context = this.getServletConfig().getServletContext();


File reportFile = new File(context.getRealPath("/reports/CptReport.jrprint"));

JasperPrint jasperPrint = (JasperPrint)JRLoader.loadObject(reportFile.getPath());

ByteArrayOutputStream baos = new ByteArrayOutputStream();


JRPdfExporter exporter = new JRPdfExporter();

exporter.setParameter(JRExporterParameter.JASPER_PRINT, jasperPrint);

exporter.setParameter(JRExporterParameter.OUTPUT_STREAM, baos);


if(baos.size() > 0)


System.out.print("en baos hay algo");




System.out.print("en baos no hay nada");



//PAra indicar el MIME


// PAra indicarle que queremos abrirlo con el Acrobat

// Y el nombre con el que queremos guardarlo



"attachment; filename=" +

"CptInforme.pdf" );




ServletOutputStream outStream = respuesta.getOutputStream();







The jasperPrint has data, and is ok, what is the problem, thank you,







By: ainhoa - sorgin

RE: pdf has no pages

2003-05-22 01:57

I went back to iText 0.96, and I solve my problem

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