You can use ByteArrayOutputStream [1<http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html>], then attach that to your mail message. If you are using low-level api, then Attrachment [2<http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/mail/MailService.Attachment.html>] has a constructor for this.
[1] http://download.oracle.com/javase/6/docs/api/java/io/ByteArrayOutputStream.html [2] http://code.google.com/appengine/docs/java/javadoc/com/google/appengine/api/mail/MailService.Attachment.html On Sun, May 15, 2011 at 9: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.
