I am looking to have the ability to view pdf files that reside on the host client from any of the remote clients. Specifically I have a pdf viewer with a file explorer on the same window to select which pdf file to view.
It looks like for this to function, in other words for me to be able to access the shared directory, I need to login to the pc. This is why it was working for me the other day.
Is there a way to “Force” the directory viewer to the local (on the host) specific directory?
Can I do something like: “file://LocalHost/C:/Reports/”
OR does that not make sense?
No, that doesn’t make sense. In order to use windows filesharing, you’ll have convince windows that you have permissions to the file. So either you configure the share on the host computer to let anyone read from it, or you log in first.
The other option is to use something other than windows filesharing. Conveniently, you already have a web server (FactoryPMI Gateway) installed. If you drop files under the C:\Program Files\Inductive Automation\FactoryPMI\tomcat\webapps\ROOT directory, they will be served up over http, and you can access them like this:
I spoke with Adam earlier today on the phone. He is going to store the PDFs as BLOBs in the database - much more user friendly to skip the hassle of dealing with windows filesharing.
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”:
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.
Yes it worked. It looks like that did the trick. I guess between grabbing as a byte array as well as my extra parenthesis around the “?” did the trick.
The main problem was writing the variable bytes to the temp file. [color=GRAY](yes - thats what I told you to do on the phone yesterday - my bad)[/color]
bytes is a PyDataSet - the return of a query. using bytes[0][0] gets the value from the first row, first column, which is the BLOB data.
One minor problem I now have is that inthe code where we make sure data is there before creating the temp file:
if len(bytes)>0:
The return of this is always 1 as this is the length of the array.
Is there a way to get the actual number of bytes of the data? This way we can differentiate between a return with NULL (not saved to) and actual PDF data that has been saved.
Thanks for your patience with my lack of knowledge on this.
EDIT:
As a quick fix, I added into my loading of the dataset: WHERE pdfBytes is not NULL which works for me for now…
That line simply retrieves the currently displayed chart as the bytes of a PDF. You could write these bytes to a *.pdf file, or email the bytes to someone as a *.pdf, or store them in the database for later retrieval.
Hi.
Im using ICEpdf-Viewer.
It also works fine if I use this Add but only on the localhost not on the network for clients. Half my clients running Ubuntu so no Acitvx.
C:\Program Files\Inductive Automation\Ignition\tomcat\webapps\main/dar.pdf
Error:
Componet name"http://IPADD:8088/main/dar.pdf" is invalid, it is either non-unique,reserved, or has an illegal charactr.