tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ing. Omar Rojas Gastélum <oma...@exatec.itesm.mx>
Subject I Really need help
Date Thu, 05 Jun 2003 17:40:59 GMT
Hi everybody

I'm new on JSP's. Actually, i'm testing the tomcat installation on my server. I need to generate
PDF's with an application package named iText (   http://www.lowagie.com/iText/   ). When
i try to run the example file i get this errors (The source of the JSP file is at the end):

Well, i don't even imagine how can solve this, any Idea?
Thank you, if you can help me... please reply my email to omar@ilinium.com

Thanx again.

Omar


***************************************
org.apache.jasper.JasperException: The document has no pages.
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:254)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:261)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:604)
	at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:562)
	at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:679)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:536)

root cause 

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 org.apache.jsp.pruebapdf_jsp._jspService(pruebapdf_jsp.java:126)
	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:494)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
	at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:261)
	at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360)
	at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:604)
	at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:562)
	at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:679)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
	at java.lang.Thread.run(Thread.java:536)
******************************





<%@ page import="java.awt.Color"%>
<%@ page import="java.io.FileOutputStream"%>
<%@ page import="java.io.IOException"%>
<%@ page import="com.lowagie.text.*"%>
<%@ page import="com.lowagie.text.pdf.PdfWriter"%>
<%@ page import="com.lowagie.text.pdf.BaseFont"%>
<%@ page import="com.lowagie.text.pdf.PdfContentByte"%>
<%
   //     out.println("PDF GENERATION IN PROGRESS...");

        // step 1: creation of a document-object
        Document document = new Document();

   String apellidos = null;
   String nombres = null;
   String fecha = null;




        try {


  //Read http request parametters

  apellidos  = "RG";

  nombres = "Omar";

  fecha = "02/02/2003";

            // step 2:
            // we create a writer that listens to the document
            // and directs a PDF-stream to a file

            PdfWriter writer = PdfWriter.getInstance(document, new
FileOutputStream("D:/ProyectoCATWEBPruebas/catweb/PDFGenerated/test.pdf"));

            // step 3: we open the document
            document.open();

            PdfContentByte cb = writer.getDirectContent();


            // step 4: we add content
            Image jpg1 = Image.getInstance("c:/temp/visa.png");
            jpg1.scalePercent(24);
            jpg1.setAbsolutePosition(0,0);

            document.add(jpg1);
            BaseFont bf = BaseFont.createFont(BaseFont.HELVETICA,
BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

            cb.setFontAndSize(bf, 12);
            cb.beginText();

cb.setTextMatrix(((int)(220*0.24)),(int)(11*72)-((int)(365*0.24)));
            cb.showText(apellidos);


cb.setTextMatrix(((int)(220*0.24)),(int)(11*72)-((int)((365+115)*0.24)));
            cb.showText(nombres);


cb.setTextMatrix(((int)(220*0.24)),(int)(11*72)-((int)((365+115*4)*0.24)));
            cb.showText(fecha);

             cb.endText();

        }
        catch(DocumentException de) {
            out.println(de.getMessage());
        }
        catch(IOException ioe) {
            out.println(ioe.getMessage());
        }

        // step 5: we close the document
        document.close();
 out.println("<SCRIPT language=/"JavaScript/">");
 out.println("<!--");
 out.println("window.location.href =     '/test.pdf';   ");
 out.println(" //-->");
 out.println("</SCRIPT>");
 %>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message