Memory-based PDF E-mail Attachement

Questions, tips and tricks and techniques for scripting in Servoy

Memory-based PDF E-mail Attachement

Postby kwpsd » Mon Jul 02, 2012 7:29 pm

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!
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 635
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA

Re: Memory-based PDF E-mail Attachement

Postby jasantana » Mon Jul 02, 2012 8:43 pm

Try this:

Code: Select all
var attachment = plugins.mail.createBinaryAttachment('MyFile.pdf', byteArray);
Best regards,
Juan Antonio Santana Medina
jasantana@nephos-solutions.co.uk
Servoy MVP 2015
Servoy 6.x - Servoy 7.x - Servoy 8.x - MySQL - PostgreSQL - Visual Foxpro 9
User avatar
jasantana
 
Posts: 555
Joined: Tue Aug 10, 2010 11:40 am
Location: Leeds - West Yorkshire - United Kingdom

Re: Memory-based PDF E-mail Attachement

Postby kwpsd » Tue Jul 03, 2012 2:43 am

Thanks, Juan, that's what I wanted...works great, too!
Kim W. Premuda
San Diego, CA USA
User avatar
kwpsd
 
Posts: 635
Joined: Sat Jul 28, 2007 6:59 pm
Location: San Diego, CA USA


Return to Methods

Who is online

Users browsing this forum: No registered users and 2 guests