Yes, After speaking with Carl yesterday, we decided to save my report as a PDF into the db as BLOB.
We worked on the scripting to get the data from the db and put dynamically into a PDF viewer component. I, however, think my script to save the report into the db is not working. Below are my scripts.
This is the code to save the report in the db. I have a BLOB type column in the table called “printedreports”:
report = event.source.parent.getComponent('Report Viewer')
fileName = "ReportName"
filedata = report.getBytesPDF()
fpmi.db.runPrepStmt("UPDATE printedreports SET pdfBytes = (?) WHERE filename = (?)", [filedata, fileName])
This is the code to retrieve the BLOB data:
filename = "2008-07-23 0500"
bytes = fpmi.db.runQuery("SELECT pdfBytes FROM printedreports WHERE filename='%s'"%filename)
tempfile = fpmi.file.getTempFile("pdf") # Create Temp PDF File place holder
fpmi.file.writeFile(tempfile, bytes) #Generate Temporary PDF File
event.source.parent.getComponent("PDF Viewer").filename = 'tempfile'
when I run either script, I do not get errors. When I run the retrieval script, I do not see the pdf file. Also, when I view the temp file, I do not see anything. It is only 1k rather than the 4k size that the actual pdf’s are.