Hi Vik,
Call toByteArray() method on ByteArrayOutputStream when finished with
creating PDF and then
MimeBodyPart attachment = new MimeBodyPart();
attachment.setFileName("whatever.pdf");
attachment.setContent(attachmentData, "application/pdf");
mp.addBodyPart(attachment);
See http://code.google.com/appengine/docs/java/mail/usingjavamail.html
Stephen
On Sun, May 15, 2011 at 9:34 AM, Vik <[email protected]> wrote:
> Hie Stephon
>
> Still I am not sure on the part that ultimately how will i use this stream
> to attach the generated pdf as an attachment in the email. Please advise
>
> Thankx and Regards
>
> Vik
> Founder
> http://www.sakshum.org
> http://blog.sakshum.org
>
>
> On Sun, May 15, 2011 at 9:56 PM, Stephen Johnson
> <[email protected]>wrote:
>
>> You're writing the PDF as your web page output. Use a
>> ByteArrayOutputStream instead.
>>
>> On Sun, May 15, 2011 at 7:16 AM, Vik <[email protected]> wrote:
>>
>>> Hie
>>>
>>> Just a little question. I am using this pdfJet thing.
>>> The requirement for us is to create a pdf and then mail it to a user.
>>>
>>> So i am done with pdf creation part and at then end i have the code
>>> like:
>>>
>>> OutputStream out = resp.getOutputStream();
>>> PDF pdf = new PDF(out);
>>>
>>> some actual writing.....
>>>
>>> pdf.flush();
>>> out.close();
>>>
>>> Now the question i have is after this step how do i actually get handle
>>> to the created pdf above and attach it to an email ?
>>>
>>>
>>> Thankx and Regards
>>>
>>> Vik
>>> Founder
>>> http://www.sakshum.org
>>> http://blog.sakshum.org
>>>
>>>
>>> On Tue, Apr 20, 2010 at 1:52 PM, Patou
>>> <[email protected]>wrote:
>>>
>>>> Hello
>>>>
>>>> In App Engine, You can't write a file to the file system. Otherwise
>>>> the save method can't be used in GAE.
>>>> Use this code to send the pdf to the navigator :
>>>>
>>>> pdf.wrap();
>>>>
>>>> String fileName = "Example_03.pdf";
>>>>
>>>> resp.setContentType("application/pdf");
>>>> resp.setHeader("Content-Disposition", "attachment; filename=\"" +
>>>> fileName + "\"");
>>>> ServletOutputStream outs = resp.getOutputStream();
>>>> pdf.getData().writeTo(outs);
>>>>
>>>> Or to save to the datastore :
>>>> new Blob(pdf.getData().toByteArray());
>>>>
>>>> Bests Regards
>>>>
>>>> Patrice
>>>>
>>>> On Apr 20, 4:18 am, jeno <[email protected]> wrote:
>>>> > Hi François ,
>>>> >
>>>> > Thanks for your help. I have used PDFjet (PDFJet.jar version 2.72)
>>>> > PDF class missing save method
>>>> > So i cant call pdf.save("d.pdf") method.
>>>> >
>>>> > Cheers
>>>> > jeno
>>>> >
>>>> > On Apr 19, 6:48 pm, François Masurel <[email protected]> wrote:
>>>> >
>>>> >
>>>> >
>>>> >
>>>> >
>>>> > > Hi Jeno,
>>>> >
>>>> > > You can try the PDFjet Open Source Edition :
>>>> http://pdfjet.com/os/edition.html
>>>> >
>>>> > > François
>>>> >
>>>> > > On 19 avr, 01:55, jeno <[email protected]> wrote:
>>>> >
>>>> > > > Hi Guys,
>>>> >
>>>> > > > Anyone know open source java pdf engine for GAE.
>>>> >
>>>> > > > Thanks
>>>> > > > Jeno
>>>> >
>>>> > > > --
>>>> > > > You received this message because you are subscribed to the Google
>>>> Groups "Google App Engine for Java" group.
>>>> > > > To post to this group, send email to
>>>> [email protected].
>>>> > > > To unsubscribe from this group, send email to
>>>> [email protected].
>>>> > > > For more options, visit this group athttp://
>>>> groups.google.com/group/google-appengine-java?hl=en.
>>>> >
>>>> > > --
>>>> > > You received this message because you are subscribed to the Google
>>>> Groups "Google App Engine for Java" group.
>>>> > > To post to this group, send email to
>>>> [email protected].
>>>> > > To unsubscribe from this group, send email to
>>>> [email protected].
>>>> > > For more options, visit this group athttp://
>>>> groups.google.com/group/google-appengine-java?hl=en.
>>>> >
>>>> > --
>>>> > You received this message because you are subscribed to the Google
>>>> Groups "Google App Engine for Java" group.
>>>> > To post to this group, send email to
>>>> [email protected].
>>>> > To unsubscribe from this group, send email to
>>>> [email protected].
>>>> > For more options, visit this group athttp://
>>>> groups.google.com/group/google-appengine-java?hl=en.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Google App Engine for Java" group.
>>>> To post to this group, send email to
>>>> [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> For more options, visit this group at
>>>> http://groups.google.com/group/google-appengine-java?hl=en.
>>>>
>>>>
>>> --
>>> You received this message because you are subscribed to the Google Groups
>>> "Google App Engine for Java" group.
>>> To post to this group, send email to
>>> [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/google-appengine-java?hl=en.
>>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine for Java" group.
>> To post to this group, send email to
>> [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/google-appengine-java?hl=en.
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.