-
1. Re: seam-pdf: footer in first page
norman.richards Feb 6, 2007 6:12 PM (in response to jcalienes)We can't yet do (1) yet due to quirks in how iText works. Sadly, I have to rewrite headers and footers for this to work. I'll see if I can get this into 1.1.6.
For (2), you'll have to experiment. You should be able to add an element with only a top border somewhere. Or, if you need a fast solution, create an image and drop it in. -
2. Re: seam-pdf: footer in first page
werter May 9, 2007 3:28 PM (in response to jcalienes)Has the problem with the footer been fixed yet?
I need to display it in my reports, my clientes requested this, so if it is possible I would like to know how it`s done. If not, then I will unfortunately be forced to use another framework for reports, which so far I have had no luck integrating because when I try to write the generated PDF using
package com.snet.relatorio;
import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import javax.ejb.EJB;
import javax.ejb.Remove;
import javax.ejb.Stateful;
import javax.ejb.Stateless;
import javax.faces.application.Application;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.faces.context.ResponseStream;
import javax.faces.webapp.FacesServlet;
import javax.persistence.EntityManager;
import javax.servlet.ServletContext;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletResponse;
import javax.sql.DataSource;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperExportManager;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;
import net.sf.jasperreports.engine.JasperPrintManager;
import net.sf.jasperreports.engine.JasperReport;
import net.sf.jasperreports.engine.JasperRunManager;
import net.sf.jasperreports.engine.util.JRLoader;
import net.sf.jasperreports.view.JasperViewer;
import org.hibernate.classic.Session;
import org.jboss.aspects.dbc.Dbc;
import org.jboss.seam.InterceptionType;
import org.jboss.seam.annotations.Create;
import org.jboss.seam.annotations.Destroy;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Intercept;
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.contexts.FacesApplicationContext;
import org.jboss.seam.core.ApplicationContext;
import org.jboss.seam.core.FacesMessages;
import org.springframework.web.servlet.view.jasperreports.JasperReportsPdfView;
@Stateless
//Name("relatorio")
@Intercept(value=InterceptionType.NEVER)
public class Relatorio implements RelatorioIf{
private String path;
private Connection con = null;
public void executar(EntityManager entityManager) throws SQLException, JRException, IOException {
ServletContext context = (ServletContext)FacesContext.getCurrentInstance().getExternalContext().getContext();
org.jboss.seam.core.FacesContext f = new org.jboss.seam.core.FacesContext();
ServletResponse response = (ServletResponse) f.getContext().getExternalContext().getResponse();
this.path = context.getRealPath("/pages/relatorios/jasper/teste.jasper");
Session session = (Session)entityManager.getDelegate();
this.con = session.connection();
JasperReport relatorio = (JasperReport)JRLoader.loadObject(this.path);
Map parametros = new HashMap();
byte[] bytes = JasperRunManager.runReportToPdf(relatorio, parametros, con);
response.setContentType("application/pdf");
response.setContentLength(bytes.length);
response.getOutputStream().write(bytes, 0, bytes.length);
response.getOutputStream().flush();
response.getOutputStream().close();
}
}
Any help would be greatly appreciated.
Darryl