# Sending Report over a mail

**URL:** <https://forum.inductiveautomation.com/t/sending-report-over-a-mail/71887>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [March 31, 2023, 8:30am UTC](https://forum.inductiveautomation.com/t/sending-report-over-a-mail/71887 "2023-03-31T08:30:46Z")\
**Posts on this page:** 1\
**Showing post:** 4

<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:** [March 31, 2023, 3:38pm UTC](https://forum.inductiveautomation.com/t/sending-report-over-a-mail/71887/4 "2023-03-31T15:38:59Z")

</div>

> [@Dharani\_T](#):
>
> ```auto
> # Initialize report bytes
> reportBytes = bytearray()
> 
> ...
> # Append process page bytes to report bytes
> reportBytes.extend(processBytes)
> 
> ```

That's not doing what you want to be doing.  
If you want to email five _separate_ PDF attachments on one email, you can make a **list** , execute each report, and store the generated data into that list to pass in to sendEmail in the attachmentData parameter.

You **cannot** directly combine the binary data for different PDFs and expect a valid PDF as the output, though. There are headers and other information that will _at best_ leave you with a totally invalid PDF-like binary blob. Ignition doesn't have any internal facility to combine PDFs, so I would highly recommend just sending five attachments. If that's really not an option, you will have to either integrate a third party Java library that can stitch together PDFs, or use a third party tool to merge the PDFs.

> [@Multiple reports with single schedule based on parameter](https://forum.inductiveautomation.com/t/multiple-reports-with-single-schedule-based-on-parameter/40613/8):
>
> Not directly within Ignition. PDFs are complicated. There’s lots of options for merging PDFs, I can’t speak to any particular one. This thread on SO is Linux-focused, so may not be helpful, but some of these tools may be available on Windows:

> [@Merge PDFs with the Similar name](https://forum.inductiveautomation.com/t/merge-pdfs-with-the-similar-name/54145):
>
> Hello Everyone, I have bunch of files in single folder. Now, out of those files,I will have to find a files with similar name and that would look like “Filename\_invoice” and “Filename\_return”. Basically I will have to find those files(PDFs). Merge them and print them. Do you think merging can be done in ignition without any external module? Let me know if anyone have done this before. Thank you

> [@Execute the same report x times and perspective download as multiple pages in a single file](https://forum.inductiveautomation.com/t/execute-the-same-report-x-times-and-perspective-download-as-multiple-pages-in-a-single-file/29407/2):
>
> Combining PDFs is not as simple as just appending the byte arrays to each other - in fact, it’s decidedly non-trivial. Looks like there are some command line tools you could use: [https://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf](https://stackoverflow.com/questions/2507766/merge-convert-multiple-pdf-files-into-one-pdf) - you’d have to execute the reports and save them somewhere on the gateway, then run an external command, then load those bytes into system.perspective.download.

---

_[View the full topic](https://forum.inductiveautomation.com/t/sending-report-over-a-mail/71887)._
