You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by Nishit Trivedi <ni...@planet.net> on 2000/06/07 15:58:21 UTC
converted PDF
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
Re: converted PDF
Posted by sudhi <su...@planet.net>.
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
Re: converted PDF
Posted by Rafael Oropeza <ro...@eud.com>.
Ok, I understand your situation. Searching about your problem in
"Professional Java Server Programming" (http://www.wrox.com), I've found
this:
"MIME messages in Java Mail API are capable of containing content other
than plain text. The setText() method is a convenience method that
accept a String object as te content an sets the content type to
text/plain. JavaMail relies on the Java Activation Framework's
DataContentHandlers for converting different content types to a byte
stream format suitable for transfer inclusion in a MIME message.
Unfortunately, the single DataContentHandler available with standard
JavaMail and JAF implementations only handles text/plain content types.
Adding support for other types is beyond the scope of this .... Refer to
JAF specification for more information"
So, I don't know how to implement this, but I hope this will be help you
to find a solution
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... NishitInternet 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
>
>
> ----------------------------------------------------------------
> ---------------------------------------------------------------------
> 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
(51) Mix a little foolishness with your serious plans: it's lovely to be
silly at the right moment.
Horace
Re: converted PDF
Posted by Nishit Trivedi <ni...@planet.net>.
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
Re: converted PDF
Posted by Rafael Oropeza <ro...@eud.com>.
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
Re: converted PDF
Posted by Stefano Mazzocchi <st...@apache.org>.
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???
Using Cocoon2 as a JAMES (java.apache.org/james/) Mailet. :-)
But this is hard-core bleeding edge and you'll have to way quite some
time...
--
Stefano Mazzocchi One must still have chaos in oneself to be
able to give birth to a dancing star.
<st...@apache.org> Friedrich Nietzsche
--------------------------------------------------------------------
Missed us in Orlando? Make it up with ApacheCON Europe in London!
------------------------- http://ApacheCon.Com ---------------------