cocoon-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sudhi <su...@planet.net>
Subject Re: converted PDF
Date Wed, 07 Jun 2000 20:07:19 GMT
Hi All,
It worked :-)
The easiest way was, Java Activation Framework.

Here is the snippet of the taglib which attaches the output of the url
as a file.
---------------------------------------------------------
          ..... 
          msgPart = new javax.mail.internet.MimeBodyPart();
          URL url = new
URL("http://localhost/samples_old/xsp/"+filename+".xml?msds=32");
          msgPart.setDataHandler(new javax.activation.DataHandler(url));

          msgPart.setFileName(filename+".pdf");
          msgContent.addBodyPart(msgPart);
          msg.setContent(msgContent);

          Transport.send(msg);
          ......

----------------------------------------------------------  

 The url which it is pointing is an xml file, which looks like this
---------------------------------------------------------------
<?xml version="1.0"?>
<?cocoon-process type="sql"?>
<?cocoon-process type="xslt"?>
<?xml-stylesheet href="msds-fo.xsl" type="text/xsl"?>

<page>

 <connectiondefs>
  <connection name="foo_connection">
   <driver>org.gjt.mm.mysql.Driver</driver>
   <dburl>jdbc:mysql://mydomain.com/test_msds</dburl>
   <username>user</username>
   <password>passwd</password>
  </connection>
 </connectiondefs> 
 
 <query connection="foo_connection" count-attribute="count">
    select
prodname,uploaddate,title,rID,revdate,upc,prodnum,category,msdsnumber,mfg,itemnum
from msds where msdsnumber = '{@msds}'
 </query>
</page>
--------------------------------------------------------------

The stylesheet msds-fo.xsl is the one which converts the resulting xml
into a PDF file.

~Sudhi



> Nishit Trivedi wrote:
> 
> ok...here is the deal...
> I have an xml file(attached with this email) to which I am applying
> sql processor.
> Then I also apply style sheet to it as you can see in attached file.
> Then I apply FOP to convert that file into PDF file.
> 
> Now the whole functionality is in one taglib. e.g.
> <email:mail to = "somebody@nothing.com" from = "nobody@something.com"
> file = "msds_for_cocoonuser.xml?msds=1"/>
> 
> When I do this, it should grab msds_for_cocoonuser.xml, apply sql
> processor to it, apply style sheet to it, apply FOP to it, store the
> PDF as stream of bytes (not as a file in a file system) and THEN send
> the PDF file as an email attachment to user. This all should happen
> dynamically.
> 
> I tried my best to explain the situation...any help will be
> appreciated...
> 
> Nishit
> Internet Programmer
> Planet Access Networks
> 973-691-4704 Ext:157
> 
>      ----- Original Message -----
>      From: Rafael Oropeza
>      To: cocoon-users@xml.apache.org
>      Sent: Wednesday, June 07, 2000 10:25 AM
>      Subject: Re: converted PDF
> 
>      The problem here is you have a converted/renderized
>      FOP version of your XML contents "on the fly" (it doesn't
>      really exists as a filesystem file). So, I think (I hope I'm
>      noty wrong) you need to generate your FOP content as a real
>      PDF file in your file system. Then, you can send this
>      generated file as an email attachment, a link to it, etc.
> 
>      Nishit Trivedi wrote:
> 
>     >  hi,
>     >  sorry if this question is somewhat unrelated to cocoon
>     >  user.
>     >  I am having xml file on which I applied FOP to convert it
>     >  to PDF.
>     >  Now I am trying to send THIS CONVERTED PDF file as email
>     >  attachment to user.
>     >  I don't have any clue  (:-(
>     >  How do i do it???
>     >
>     >  Thanx in advnace...
>     >
>     >  Nishit
>     >  Internet Programmer
>     >  Planet Access Networks
>     >  973-691-4704 Ext:157
>     >
>     >  --------------------
>     >  ------------------------------------------------
>     >  To unsubscribe, e-mail:
>     >  cocoon-users-unsubscribe@xml.apache.org
>     >  For additional commands, e-mail:
>     >  cocoon-users-help@xml.apache.org
>     >
> 
>      --
>      Rafael Alberto Oropeza Baudet
> 
>      (66) Rather than love, than money, than fame, give me truth
>      Henry David Thoreau
> 
> 
>                               Name: msds_for_cocoonuser.xml
>    msds_for_cocoonuser.xml    Type: BizTalk Schema (text/xml)
>                           Encoding: quoted-printable
> 
>     ---------------------------------------------------------------
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cocoon-users-unsubscribe@xml.apache.org
> For additional commands, e-mail: cocoon-users-help@xml.apache.org

Mime
View raw message