[seam-dev] PDF: missing pageEventClass

Kenneth Christensen kec at mediatorsystems.com
Sat Aug 22 16:47:30 EDT 2009


Maybe someone could explain me why the "pageEventClass" have been  
removed from the UIDocument and why is it not supported by Seam PDF  
anymore?

JBoss Seam 2.0.3:

     @Override
     public void encodeBegin(FacesContext context)
         throws IOException
     {
         super.encodeBegin(context);

         stream = new ByteArrayOutputStream();

         try {
             writer = createWriterForStream(stream);

             initMetaData(context);
             initPageEvent(writer);
             processHeaders();

             document.open();
         } catch (DocumentException e) {
             throw new RuntimeException(e);
         }
     }

     protected void initPageEvent(DocWriter writer) {
         if (pageEventClass != null && writer instanceof PdfWriter) {
             try {
                 PdfPageEvent event = (PdfPageEvent)  
Class.forName(pageEventClass).getConstructor().newInstance();
                 ((PdfWriter) writer).setPageEvent(event);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
         }
     }

JBoss Seam 2.2.0:

    @Override
    public void encodeBegin(FacesContext context) throws IOException
    {
       super.encodeBegin(context);

       stream = new ByteArrayOutputStream();

       try
       {
          writer = createWriterForStream(stream);

          initMetaData(context);
          processHeaders();

          document.open();
       }
       catch (DocumentException e)
       {
          throw new RuntimeException(e);
       }
    }

Best regards

Kenneth Christensen



More information about the seam-dev mailing list