I am currently trying to get checkmarks to display in a PDF Viewer after saving it as a report.
The report looks as follows: the edit text under property inspector reads @taxable == 1 ? “”: “☐” @ since the data in the db is boolean. In the report “Preview” tab this appears as the following image (it also appears this way when saving the report as a PDF on the main window to our files):
However, on the PDF Viewer from that same window, after saving the report, the checkboxes appear to be empty:
The font used is Arial as well.
Everyone please welcome my coworker! @Carly_Jankowski
This is something we’ve been working on.
For reference we used this Reporting checkboxes? - #4 by KathyApplebaum post to get the logic of showing a checkbox or not.
Do the checkboxes show in an external PDF Viewer application?
We can save the reports via system.report.executeAndDistrbute, and those open correctly in external PDF Viewer programs like Adobe- I see Check marks.
When it is open in PDF from the database inside a PDF Viewer component on the same computer inside Ignition - I get boxes as though a character is missing.
Huh. That wasn't the answer I was expecting.
No idea. Maybe try different fonts?
Our process is we have a gateway message handler make the PDF on the gateway and then immediately grab the file and save it to the database like this
system.report.executeAndDistribute(path="VendorPO", project="PSM4_Project", parameters=reportingParameters, action="save", actionSettings=settings)
fullFilePath = rootDir + "\\" + reportName
bytes = system.file.readFileAsBytes(fullFilePath)
system.db.runPrepUpdate("INSERT INTO listvendorPOPDFs (vendorPOId, PDFData) VALUES (?, ?)", [idx, bytes])
When looking at the PDF that was saved via exceuteAndDistribute I see the checkboxes, when I load the blob to PDF Viewer I do not.
We are using Arial, Bold
as the font. Do you have any font suggestions that you think might work?
Have you verified that the file and the DB contents are byte exact? Any possibility that the file isn’t finished writing when you grab it?
Consider not writing the file if you are just going to put it in the DB. Use system.report.execute
and retrieve the PDF bytes directly to put in the DB.
Ok tried it like so
settings = {"path":rootDir, "fileName":reportName, "format":"pdf"}
system.report.executeAndDistribute(path="VendorPO", project="PSM4_Project", parameters=reportingParameters, action="save", actionSettings=settings)
fullFilePath = rootDir + "\\" + reportName
bytes = system.report.executeReport(path='VendorPO', project='PSM4_Project', parameters=reportingParameters, fileType='pdf')
system.db.runPrepUpdate("INSERT INTO listvendorPOPDFs (vendorPOId, PDFData) VALUES (?, ?)", [idx, bytes])
Here it is via PDF Viewer component as retrieved from the database -
And here is the file opened directly from the PDF
I guess I will have to check if they are bytes exact at this point.
They are bytes identical
path = 'C:\\Reports\\psm4,Project-0972-2022-1.pdf'
fileBytes = system.file.readFileAsBytes(path)
dbBytes = system.db.runScalarQuery("SELECT PDFData FROM listvendorpopdfs WHERE idx=1")
print fileBytes == dbBytes
This prints out true to me. So what the report saved on my file system is byte-identical to what is saved in the database blob column.
Ok, now I have no idea. I still suspect something to do with fonts.
Idk about vision or whatever, But i vaguely remeber my mom having trouble opening a pdf a long time ago, because the pdf was created by a newer version of an editor(like adobe) which had a feature her pc didnt have yet.
Maybe your checkbox is something of a “new pdf feature” the vision viewer cant handle?
Our old printer also had troubles printing pdfs becuase of this