I have a user who generates a report in Excel and exporting as a PDF. I want the user to be able to upload the PDF to Ignition. One issue I am having is that the report is exceptionally long, and when displayed on a dashboard, the font is too small. The location they will upload this to will be on a slide show. I want to split this long pdf into two separate pdfs and display them on different slides. I am trying to figure out how I can accomplish this. Any suggestions would be appreciated.
I currently have PDFs being uploaded and saved using the blob server module. Automation Professionals' Blob Server Module . I then wrote some code with FileUpload onFileReceived that writes to a tag.
blobID = 1
tagID = "[default]Blob Info/Safety 1"
# Grab the file name and data
filename = event.file.name
filedata = event.file.getBytes()
query = "SELECT blob as Content, 'application/pdf' as ContentType from files where id = ?"
args = [blobID]
db = "PostgreSQLPersonal"
temp = system.db.runPrepQuery(query, args, db).getRowCount()
if temp == 0:
query = "INSERT INTO files (id, blob) VALUES (?, ?)"
args = [blobID,filedata]
db = "PostgreSQLPersonal"
system.db.runPrepUpdate(query, args, db)
else:
query = "UPDATE files SET blob = ? WHERE id = ?"
args = [filedata,blobID]
db = "PostgreSQLPersonal"
system.db.runPrepUpdate(query, args, db)
system.tag.writeBlocking([tagID], [""])
sleep(1)
system.tag.writeBlocking([tagID], ['http://xx.xx.xxx.xxx/system/blob/SafetySlides/SimpleBlob?id='+str(blobID)])
This works as expected. Is it possible to split filedata
into two pdfs, or is there a different way I should approach it?