logo

New Response

« Return to the blog entry

You are replying to:

    • avatar
    • Jake White
    • Posted on Tue 17 Jun 2008 02:17 PM

    Jake --

    The code I linked to uses a disk file as an input stream -- I'm pretty sure any byte stream could be used and its content written as an attachment (perhaps by getting the bytes and passing them into a Notes "Stream" object).

    My application code (can't post it, sorry) uses a Java PDF library to stamp an value on every page of a file, then return that result as a downloadable attachment.

    My code first gets the source file as an input stream, then hands that to the PDF library, which generates an output stream containing the stamped PDF.

    I then pass the output stream to the SetContentFromBytes method of NotesMimeEntity (like in the linked article).

    I then close the MIMEEntities, and save the new document.

    Finally, I create a URL like .../database.nsf/0/big_unid_here/$File/myattachmentname.pdf?OpenElement and redirect the browser to that URL using PrintWriter("["+url+"]")

    Again, the approach has its weaknesses, but it does avoid disk I/O (and security issues on a server I don't "own").

    Jake

Your Comments

Name:
E-mail:
(optional)
Website:
(optional)
Comment: