[jboss-user] [JBoss Seam] - Re: issue with itext pdf generation and JSF RI

borisrodman do-not-reply at jboss.com
Thu Apr 26 11:37:21 EDT 2007


I managed to find the issue:
in the UIdocument class seam forward to a page that redirect to the PDF document:
the page rendered has no Doctype specified and the MIME return type is set to XML/Application (or something similar) therefore firefox doesn't know what to do with it.
A agree with you that it doesn't bother IE

to fix the issue you must change the class:
org.jboss.seam.pdf.ui.UIDocument to output a doctype:

in the medhod:     public void encodeBegin(FacesContext context) 
replace the following lines (from line 233):

  |             ResponseWriter response = context.getResponseWriter();
  |             response.startElement("html", this);
  |             response.startElement("head", this);

  |             ResponseWriter response = context.getResponseWriter();
  |             response.write("<!DOCTYPE composition PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\" >");
  |             response.startElement("html", this);
  |             response.writeAttribute("xmlns", "http://www.w3.org/1999/xhtml", null);
  |             response.startElement("head", this);

then recompile seam using the std build file (this will also recompile jboss-seam-pdf.jar where this class ends-up)
and replace jboss-seam-pdf.jar in your project by the re-compiled jar

It SHOULD work ! (At leasts it does for me)

Also note that if you use the source code from CVS the jboss.jpg image in the itext example was corrupted last week which resulted in the PDF rendering to fail. (I don't know if this has been corrected since then)

Let me know if you have any issues !

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4041060#4041060

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4041060

More information about the jboss-user mailing list