# PDF Report send to email

**URL:** <https://forum.inductiveautomation.com/t/pdf-report-send-to-email/61077>\
**Category:** Ignition\
**Tags:** ignition80, perspective\
**Created:** [June 22, 2022, 7:42pm UTC](https://forum.inductiveautomation.com/t/pdf-report-send-to-email/61077 "2022-06-22T19:42:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Paul.M](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@Paul.M](https://forum.inductiveautomation.com/u/Paul.M)\
**Post date:** [June 22, 2022, 7:42pm UTC](https://forum.inductiveautomation.com/t/pdf-report-send-to-email/61077/1 "2022-06-22T19:42:09Z")

</div>

Hello guys,

I'm trying to send a pdf report as an email attachment. The script will run according to a schedule, the report will be generated with "system.report.executeReport".

Everything work until I add my "attachmentData" (PDF file) and I receive the next error.

> com.inductiveautomation.ignition.common.script.JythonExecException  
> Traceback (most recent call last):  
> File "function:runAction", line 32, in runAction  
> AttributeError: 'array.array' object has no attribute 'getBytesPDF'

```
caused by org.python.core.PyException

```

Traceback (most recent call last):  
File "function:runAction", line 32, in runAction  
AttributeError: 'array.array' object has no attribute 'getBytesPDF'

Ignition v8.1.17 (b2022051210)  
Java: Azul Systems, Inc. 11.0.15

Script

```auto
#content, recipients
	BuildHTML = "<html><body><p> Test</p></body></html>"   
	subject = 'test'
	body = BuildHTML	
	to = ['xxxxxxxxxxx']
	
	#try to build report
	a = system.report.executeReport(path="test", project="xxxxxxxx", fileType="pdf")
	attachmentNames = ['test.pdf']
	
	attachmentData=[a.getBytesPDF()] #Make into PDF data for email
	
	#send email function
	sendmail(subject, body, to, cc = None , bcc = None, attachmentNames = attachmentNames, attachmentData = attachmentData)

```

\*_script run with no problem if I try to send it with no attachemnt_

Best Regards,

Paul

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 22, 2022, 7:44pm UTC](https://forum.inductiveautomation.com/t/pdf-report-send-to-email/61077/2 "2022-06-22T19:44:55Z")

</div>

`executeReport` is already handing you back a byte array. You don’t need to `getBytesPDF`.

```python
#try to build report
reportData = system.report.executeReport(path="test", project="xxxxxxxx", fileType="pdf")
attachmentNames = ['test.pdf']

attachmentData=[reportData]

```

---

<div class="post-metadata">

**Author:** ![Paul.M](https://avatars.discourse-cdn.com/v4/letter/p/c0e974/32.png) [@Paul.M](https://forum.inductiveautomation.com/u/Paul.M)\
**Post date:** [June 22, 2022, 8:50pm UTC](https://forum.inductiveautomation.com/t/pdf-report-send-to-email/61077/3 "2022-06-22T20:50:25Z")

</div>

Worked perfectly!

Thanks 😃
