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?