Hi Vik,

   This should be possible with appengine and Google Docs, but it may
not be easy.

   For any Google account you have 1GB of Google Docs usage free and
additional
storage is $0.25 per GB, so you could be creative with storing files
(securely) and or
moving them to other backup.

   Here's how it could be done:

   For 'creating a PDF' you would actually create or edit a Google
Docs document on the fly
and keep that stored in Google Docs.  (Google Documents List API...
Creating a permanent
generic version of the document and making a copy and editing the copy
on the fly would be easiest.)

  In the email to the donor, you would give them a url that they will
use to download the file as a pdf.

  That url for the pdf would not be the Google Docs url, but would be
a url to your appengine application.
That specific delivery url would have to not use Google authentication
(though the rest of your urls would continue to).  For that delivery
url, you would have to implement your own programatic authentication
and authorization for that delivery url and supply donor specific auth/
auth to the donor in an easy to use manner.

  Behind the scenes in your app: Since your application is already
authenticated with Google
and authorized to access your Google Docs, you would read the PDF
export stream directly
into the response stream to the donor.  A brief look at the Google
Documents List API
suggests that that's possible, but I haven't tried it.

Cheers,
    Nichole


On May 29, 9:07 pm, Vik <vik....@gmail.com> wrote:
> Hie Nichole
>
> My use case is different. We are a non profit and our systems wants to
> implement a automatic appreciation certification mailing facility to the
> blood donor after blood donation.
>
> So, I need to create the pdf certificate on the fly and email it to the
> blood donor. So the google docs approach wont help us.
>
> Thankx and Regards
>
> Vik
> Founderhttp://www.sakshum.orghttp://blog.sakshum.org
>
>
>
>
>
>
>
> On Mon, May 30, 2011 at 9:20 AM, Nichole <nichole.k...@gmail.com> wrote:
> > I haven't tried this programmatically, but you can export a Google
> > Docs document in pdf format.
> > If it's useful to store your files or a generic version of the file
> > which you can copy and specialize as a Google Doc, then export as pdf
> > might be a good way to create a PDF file.
> > I'd be interested in hearing how well that works for you if you do
> > implement it.
>
> > On May 20, 10:42 am, Vik <vik....@gmail.com> wrote:
> > > any further advise on this please?
> > > Thankx and Regards
>
> > > Vik
> > > Founderhttp://www.sakshum.orghttp://blog.sakshum.org
>
> > > On Wed, May 18, 2011 at 12:03 PM, Vik <vik....@gmail.com> wrote:
> > > > Hie
>
> > > > Even below code fails for the same exception
>
> > > >      ByteArrayOutputStream out = new ByteArrayOutputStream();
> > > >  PDF pdf;
> > > > try {
> > > > pdf = new PDF(out);
> > > >  log.info("#1");
> > > >         pdf.setTitle("Using TextColumn and Paragraph classes");
> > > >         pdf.setSubject("Examples");
> > > >         pdf.setAuthor("Innovatics Inc.");
> > > >         log.info("#2");
>
> > > >         Page page = new Page(pdf, Letter.PORTRAIT);
> > > >          pdf.flush();
>
> > > >            Multipart mp = new MimeMultipart();
> > > >             MimeBodyPart htmlPart = new MimeBodyPart();
> > > >             htmlPart.setFileName("whatever.pdf");
> > > >             log.info("#7");
> > > >             htmlPart.setContent(out.toByteArray(), "application/pdf");
> > > >             mp.addBodyPart(htmlPart);
> > > >             log.info("#8");
> > > >             Properties props = new Properties();
> > > >             Session session = Session.getDefaultInstance(props, null);
>
> > > >             Message msg = new MimeMessage(session);
> > > >             msg.setContent(mp);
> > > >             msg.setFrom(new InternetAddress("vik....@gmail.com"));
> > > >             msg.addRecipient(Message.RecipientType.TO,
> > > >                         new InternetAddress("vik....@gmail.com"));
>
> > > >             msg.setSubject("testing PDF system");
> > > >             Transport.send(msg);
> > > >  Thankx and Regards
>
> > > > Vik
> > > > Founder
> > > >http://www.sakshum.org
> > > >http://blog.sakshum.org
>
> > > > On Wed, May 18, 2011 at 10:25 AM, Stephen Johnson <
> > onepagewo...@gmail.com>wrote:
>
> > > >> Try not adding the image or the font. Just try to get as simple a PDF
> > > >> working as possible.
>
> > > >> On Tue, May 17, 2011 at 9:47 PM, Vik <vik....@gmail.com> wrote:
> > > >> > Hie
> > > >> > I am doing exact same. Here is the code:
> > > >> > log.info("start of PDFTest:::::::::::::");
> > > >> >     //OutputStream out = resp.getOutputStream();
> > > >> >     ByteArrayOutputStream out = new ByteArrayOutputStream();
> > > >> > PDF pdf;
> > > >> > try {
> > > >> > pdf = new PDF(out);
> > > >> > log.info("#1");
> > > >> >         pdf.setTitle("Using TextColumn and Paragraph classes");
> > > >> >         pdf.setSubject("Examples");
> > > >> >         pdf.setAuthor("Innovatics Inc.");
> > > >> >         log.info("#2");
> > > >> >         String fileName = "images/share_facebook.png";
> > > >> >         Image image1 = new Image(pdf, new BufferedInputStream(
> > > >> >                 getClass().getResourceAsStream(fileName)),
> > > >> ImageType.PNG);
> > > >> >         log.info("#3");
> > > >> >         Font f1 = new Font(pdf,
> > > >> >                 new
> > BufferedInputStream(getClass().getResourceAsStream(
> > > >> >                         "fonts/DroidFonts/DroidSerif-Regular.otf")),
> > > >> >                 CodePage.UNICODE,
> > > >> >                 Embed.YES);
>
> > > >> >         Page page = new Page(pdf, Letter.PORTRAIT);
> > > >> >         f1.setSize(10);
> > > >> >         image1.setPosition(90, 35);
> > > >> >         image1.scaleBy(0.75);
> > > >> >         image1.drawOn(page);
> > > >> >         TextColumn column = new TextColumn(f1);
> > > >> >         column.setLineBetweenParagraphs(false);
> > > >> >         Paragraph p1 = new Paragraph();
> > > >> >         p1.setAlignment(Align.CENTER);
> > > >> >         p1.add(new TextLine(f1, "Switzerland"));
> > > >> >         Paragraph p2 = new Paragraph();
> > > >> >         p2.add(new TextLine(f1, "Introduction"));
>
> > > >> >         Paragraph p4 = new Paragraph();
> > > >> >         p4.add(new TextLine(f1, "Economy"));
> > > >> >         Paragraph p5 = new Paragraph();
> > > >> >         p5.setAlignment(Align.JUSTIFY);
> > > >> >         text = new TextLine(f1);
>
> > > >> >         column.setSize(470, 100);
> > > >> >         Point point1 = new Point(90, 300);  // TextColumn start
> > point
> > > >> >         Point point2 = column.sizeOn(page); // TextColumn end point
> > > >> >         Line line = new Line(
> > > >> >                 point1.getX(),
> > > >> >                 point1.getY() + point2.getY(),
> > > >> >                 point1.getX() + point2.getX(),
> > > >> >                 point1.getY() + point2.getY());
> > > >> >         line.drawOn(page);
> > > >> >         column.drawOn(page);
>
> > > >> >         pdf.flush();
>
> > > >> >           Multipart mp = new MimeMultipart();
> > > >> >             MimeBodyPart htmlPart = new MimeBodyPart();
> > > >> >             htmlPart.setFileName("whatever.pdf");
> > > >> >             log.info("#7");
> > > >> >             htmlPart.setContent(out.toByteArray(),
> > "application/pdf");
> > > >> >             mp.addBodyPart(htmlPart);
> > > >> >             log.info("#8");
> > > >> >             Properties props = new Properties();
> > > >> >             Session session = Session.getDefaultInstance(props,
> > null);
> > > >> >             Message msg = new MimeMessage(session);
> > > >> >             msg.setContent(mp);
> > > >> >             msg.setFrom(new InternetAddress("vik....@gmail.com"));
> > > >> >             msg.addRecipient(Message.RecipientType.TO,
> > > >> >                         new InternetAddress("vik....@gmail.com"));
>
> > > >> >             msg.setSubject("testing PDF system");
> > > >> >             Transport.send(msg);
> > > >> >          System.out.println("Sucessfully Sent mail to All Users");
> > > >> > Thankx and Regards
>
> > > >> > Vik
> > > >> > Founder
> > > >> >http://www.sakshum.org
> > > >> >http://blog.sakshum.org
>
> > > >> > On Tue, May 17, 2011 at 9:30 PM, Stephen Johnson <
> > > >> onepagewo...@gmail.com>
> > > >> > wrote:
>
> > > >> >> Vik,
> > > >> >> Post your code where you're creating the ByteArrayOutputStream and
> > > >> >> creating the PDF with it. It'll be more helpful then what you've
> > > >> >> posted. I'm a little concerned you still don't have this part
> > correct
> > > >> >> since you're still using "out" as a variable name. You're code
> > should
> > > >> >> be similar to:
>
> > > >> >> ByteArrayOutputStream baos = new ByteArrayOutputStream();
>
> > > >> >> /* this part is from your previous email. I don't use PDFJet so I
> > > >> >> can't validate this code for you */
> > > >> >> PDF pdf = new PDF(baos);
> > > >> >> some actual writing.....
> > > >> >>  pdf.flush();
>
> > > >> >> /* taken from docs */
> > > >> >>  Properties props = new Properties();
> > > >> >>  Session session = Session.getDefaultInstance(props, null);
>
> > > >> >>  String msgBody = "...";
>
> > > >> >>  try {
> > > >> >>             Message msg = new MimeMessage(session);
> > > >> >>             msg.setFrom(new InternetAddress("ad...@example.com",
> > > >> >> "Example.com Admin"));
> > > >> >>             msg.addRecipient(Message.RecipientType.TO,
> > > >> >>                              new InternetAddress("u...@example.com
> > ",
> > > >> >> "Mr. User"));
> > > >> >>             msg.setSubject("Your Example.com account has been
> > > >> activated");
> > > >> >>             msg.setText(msgBody);
>
> > > >> >>            Multipart mp = new MimeMultipart();
>
> > > >> >>          // Get the PDF data
> > > >> >>          byte[] attachmentData = baos.toByteArray();
>
> > > >> >>           MimeBodyPart attachment = new MimeBodyPart();
> > > >> >>           attachment.setFileName("manual.pdf");
> > > >> >>           attachment.setContent(attachmentData, "application/pdf");
> > > >> >>           mp.addBodyPart(attachment);
>
> > > >> >>           message.setContent(mp);
> > > >> >>           Transport.send(msg);
>
> > > >> >>    } catch (AddressException e) {
> > > >> >>             // ..
> > > >> >>    } catch (MessagingException e) {
> > > >> >>             // ...
> > > >> >>     }
>
> > > >> >> On Tue, May 17, 2011 at 6:19 AM, Vik <vik....@gmail.com> wrote:
>
> > > >> >> > I think the problem is not with pdfJet it about sending pdf as an
> > > >> >> > attachment via mail api on app engine
> > > >> >> > Thankx and Regards
>
> > > >> >> > Vik
> > > >> >> > Founder
> > > >> >> >http://www.sakshum.org
> > > >> >> >http://blog.sakshum.org
>
> > > >> >> > On Tue, May 17, 2011 at 6:45 PM, Nichole <nichole.k...@gmail.com
>
> > > >> wrote:
>
> > > >> >> >> You could try iText:
>
> > > >>http://groups.google.com/group/google-appengine-java/browse_thread/th.
> > ..
>
> >http://code.google.com/appengine/docs/java/mail/usingjavamail.html
>
> > > >> >> >> On May 16, 7:11 pm, Vik <vik....@gmail.com> wrote:
> > > >> >> >> >    Hie
>
> > > >> >> >> > Trying to send a pdf created using pdfJet throws the exception
>
> > > >> >> >> > class javax.mail.SendFailedException:Send failure
> > > >> >> >> > (javax.mail.MessagingException: Converting attachment data
> > failed)
>
> > > >> >> >> > The code is like:
>
> > > >> >> >> >          MimeBodyPart htmlPart = new MimeBodyPart();
> > > >> >> >> >             htmlPart.setFileName("whatever.pdf");
> > > >> >> >> >             htmlPart.setContent(out.toByteArray(),
> > > >> >> >> > "application/pdf");
> > > >> >> >> >             mp.addBodyPart(htmlPart);
>
> ...
>
> read more »

-- 
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 google-appengine-java@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to