You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by liam grimes <li...@gmail.com> on 2007/03/26 11:54:05 UTC

Email

Hi all have anyone tried to render the fo stream to pdf and email it to an
recipient.?? Is it possible in java.. if so can you please help.
Thanx

Re: Email

Posted by Mukku Sarath Kiran <mu...@gmail.com>.
liam grimes <liamgrimes <at> gmail.com> writes:

> 
> Hi all have anyone tried to render the fo stream to pdf and email it to an 
recipient.?? Is it possible in java.. if so can you please help.Thanx


Hi,

 render fo stream to pdf : download fop 0.93 , see there is example   
                           ExampleFO2PDF.java. you can get an idea.


 for emailing pdf, you can write program like

     javax.mail.Session mailSession   = javax.mail.Session.getDefaultInstance( 
                                                  properties, null );
            Multipart  mep            = new MimeMultipart();
            MimeBodyPart mebp1          = new MimeBodyPart();
            MimeBodyPart mebp2          = new MimeBodyPart();
            
            message = new MimeMessage( mailSession );
            message.setFrom( );
            message.setRecipients( );
            
            try {                    
                    if (Attachment!=null) {
                        FileDataSource fds = new FileDataSource( Attachment );
                        mebp2.setDataHandler( new DataHandler( fds ));
                        mebp2.setFileName( fds.getName() );
                    }
                }
               
            mebp1.setText( );                
            mep.addBodyPart( mebp1 );            
            mep.addBodyPart( mebp2 );

            // add the Multipart to the message
            message.setContent( mep );
                                                
            Transport.send( message, addrRecipient );

  sarath




---------------------------------------------------------------------
To unsubscribe, e-mail: fop-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-users-help@xmlgraphics.apache.org