# Merging Multiple PDF Reports into a Single File and Downloading in Ignition Perspective

**URL:** <https://forum.inductiveautomation.com/t/merging-multiple-pdf-reports-into-a-single-file-and-downloading-in-ignition-perspective/102231>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [February 12, 2025, 6:46am UTC](https://forum.inductiveautomation.com/t/merging-multiple-pdf-reports-into-a-single-file-and-downloading-in-ignition-perspective/102231 "2025-02-12T06:46:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goutham\_Rao\_Y](https://avatars.discourse-cdn.com/v4/letter/g/eb9ed0/32.png) [@Goutham\_Rao\_Y](https://forum.inductiveautomation.com/u/Goutham_Rao_Y)\
**Post date:** [February 12, 2025, 6:46am UTC](https://forum.inductiveautomation.com/t/merging-multiple-pdf-reports-into-a-single-file-and-downloading-in-ignition-perspective/102231/1 "2025-02-12T06:46:43Z")

</div>

Hello team,

How can I combine into a single PDF file in Ignition Perspective and download it using `system.perspective.download`?

Here is the script generating the PDF byte arrays:

def runAction(self, event):

```
		startTime = '2024-12-21 10:00:05'
		endTime = '2024-12-21 11:31:53'
		interval = 1	
		
		matching_levels = [
			{'ID': 1, 'Level': 'ESD 1'},
			{'ID': 2, 'Level': 'ESD 2'},
			{'ID': 3, 'Level': 'ESD 2.1'}
		]
		
		merged_pdf_bytes = ""
		
		for level in matching_levels:
			params = {
			    "StartDate": startTime,
			    "EndDate": endTime,
			    "Level": level['ID'],    
			    "Valves": interval,
			    "Name": level['Level']
			}
			
			file_bytes = system.report.executeReport(
			    path = "PSD Report",
			    project = system.util.getProjectName(),
			    parameters = params,
			    fileType = 'pdf'
			)
			
			# need to merge file_bytes each time the loop runs and store the overall result in merged_pdf_bytes variable
			
		filename = "Reports.pdf"
		system.perspective.download(filename, merged_pdf_bytes)

```

What is the best way to merge these byte arrays into a single PDF and trigger a download?

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [February 12, 2025, 9:26am UTC](https://forum.inductiveautomation.com/t/merging-multiple-pdf-reports-into-a-single-file-and-downloading-in-ignition-perspective/102231/2 "2025-02-12T09:26:52Z")

</div>

Please see [Wiki - how to post code on this forum](https://forum.inductiveautomation.com/t/wiki-how-to-post-code-on-this-forum/77831).

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 12, 2025, 1:27pm UTC](https://forum.inductiveautomation.com/t/merging-multiple-pdf-reports-into-a-single-file-and-downloading-in-ignition-perspective/102231/3 "2025-02-12T13:27:00Z")

</div>

There's no built-in solution. You cannot just merge the bytes--that makes a corrupt PDF file. I recommend the "PDFtk" external tool for this (community edition). Call the command line "pdftk server" using java's ProcessBuilder.

---

<div class="post-metadata">

**Author:** ![stevenson](https://avatars.discourse-cdn.com/v4/letter/s/41988e/32.png) [@stevenson](https://forum.inductiveautomation.com/u/stevenson)\
**Post date:** [May 6, 2025, 4:53pm UTC](https://forum.inductiveautomation.com/t/merging-multiple-pdf-reports-into-a-single-file-and-downloading-in-ignition-perspective/102231/4 "2025-05-06T16:53:34Z")

</div>

Late response- but we just released a module to help with this specific situation.

> **[Community | Artek Integrated Solutions](https://artekis.io/community/)**

```python
report1 = system.report.execute()
report2=system.report.execute()

system.perspective.download(system.artek.mergeMultiPDF([report1,report2]))

```
