Page 1 of 1

Memory-based PDF E-mail Attachement

PostPosted: Mon Jul 02, 2012 7:29 pm
by kwpsd
Version: 6.0.6 - build 1232

Currently, we generate a Jasper Report, save it to disk as a PDF file, then attach the PDF file to an e-mail. Works great.

Is there a way to take the Jasper Report byte array output, for example:

Code: Select all
var byteArray = plugins.jasperPluginRMI.runReport()

convert it a PDF file in memory, then attach it to an e-mail (we are trying to eliminate the intermediate step of creating a physical disk file)? If so, how?

Thanks in advance for any suggestions!

Re: Memory-based PDF E-mail Attachement

PostPosted: Mon Jul 02, 2012 8:43 pm
by jasantana
Try this:

Code: Select all
var attachment = plugins.mail.createBinaryAttachment('MyFile.pdf', byteArray);

Re: Memory-based PDF E-mail Attachement

PostPosted: Tue Jul 03, 2012 2:43 am
by kwpsd
Thanks, Juan, that's what I wanted...works great, too!