# Memory-based PDF E-mail Attachement

**URL:** <https://forum.servoy.com/t/memory-based-pdf-e-mail-attachement/16125>\
**Category:** Classic Servoy\
**Created:** [July 2, 2012, 5:29pm UTC](https://forum.servoy.com/t/memory-based-pdf-e-mail-attachement/16125 "2012-07-02T17:29:39Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [July 2, 2012, 5:29pm UTC](https://forum.servoy.com/t/memory-based-pdf-e-mail-attachement/16125/1 "2012-07-02T17:29:39Z")

</div>

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:

```auto
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!

---

<div class="post-metadata">

**Author:** ![jasantana](https://avatars.discourse-cdn.com/v4/letter/j/e79b87/32.png) [@jasantana](https://forum.servoy.com/u/jasantana)\
**Post date:** [July 2, 2012, 6:43pm UTC](https://forum.servoy.com/t/memory-based-pdf-e-mail-attachement/16125/2 "2012-07-02T18:43:42Z")

</div>

Try this:

```auto
var attachment = plugins.mail.createBinaryAttachment('MyFile.pdf', byteArray);

```

---

<div class="post-metadata">

**Author:** ![kwpsd](https://avatars.discourse-cdn.com/v4/letter/k/bb73d2/32.png) [@kwpsd](https://forum.servoy.com/u/kwpsd)\
**Post date:** [July 3, 2012, 12:43am UTC](https://forum.servoy.com/t/memory-based-pdf-e-mail-attachement/16125/3 "2012-07-03T00:43:06Z")

</div>

Thanks, Juan, that’s what I wanted…works great, too!
