Add pdf files as part of project

Is there any way to add .pdf files as part of the project?
Basically we would like to use the pdf file viewer to open manual pdf’s but don’t want to server them from the server, but from the client.

I believe the scope of the PDF Viewer on the client would the clients hard drive. Have you tried putting in a file path that exists on the client into the PDF viewer, while on the client? Seems like it should work.

Well that is an option, but that doesn’t help new client etc… that need those files.

I can setup a share from the gateway, but I’m just hoping there is a way to deliver random files to the client through the project payload.

I’m confused on what your looking for. In your first post you said you didn’t want to get them from the server but your reply sounds like you don’t want to have to put them on to each client computer individually.

To use the PDF’s in a client you have to store them somewhere. You can either have a copy on every client computer you have which would be a challenge to maintain to make sure they are all the same when you update one or add any new ones. You can store them on a shared drive that all of the client computers can reach. Then the client can look at that drive to find them. Or you can store them in a database and query them as needed. All methods have pro’s and cons. It comes down to how do you want to get them.

Storing them on each computer means you have to be able to either push them out to every computer when any are updated or you have to physically go to each computer to update them.

Having them on a shared drive isn’t a bad option but you have to make sure every client computer can reach the drive location you put them in. If your trying to give easy methods to pick which one they want then you also need to make sure the drive is labeled the same.

Storing them in a database avoids both of those but depending on your file size the query to pull them back out can be slow. You also have to do a little more with python to convert the file to upload it to the DB and when you pull it back out.

If your hoping to be able to push files from the gateway to the client I’m not sure that you could do that very easy. The only way I could see doing that would still be having them stored on a shared drive or in a DB. Then having a startup script check whichever location you have them in to see whats there and compare it to the local folder to see if something is missing or has changed. Then if something is missing or changed you would need to script copying from the shared drive or DB to the local folder. Personally I think that would be a bigger headache than its worth trying to get it working right. I’m also not sure how you would work out having it check for changes to the files.

Sorry about the confusion…

I’d like to have them on the client. But I’d like them to show up as part of the project. A few other SCADA systems that we work with allow this sort of thing, I just wasn’t sure if Ignition would let you put random files in the project directory and have them delivered with the project.

We have a product that we sell as a “standard” system to many different customers and was looking for the easiest way to include pdf, manuals, drawings etc… as part of the project so that they will automatically get delivered to the client computer. That was we don’t have to put them directly on each client computer, but then each client won’t be pulling data from the server either.

I think we will just plan on a server share and work from there.

Copy the bytes into a client dataset tag?

1 Like

Yeah, @jpark’s option is the closest - or for a slightly “better” option, you could use the Webdev module, which lets you embed a file directly as a project resource, but then retrieving it takes a little bit more work - plus you have to buy the Webdev module.

So how would I extract the bytes from the client tag and feed it to the pdf viewer? Would I have to stream them to a file and then open that file with the PDF Viewer? Or can I pass the bytes to the PDF Viewer natively?

pdfViewer = event.source.parent.getComponent('PDF Viewer')

# Read the bytes into a dataset tag
filePath = "C:\\ipsum.pdf"
fileBytes = system.file.readFileAsBytes(filePath)
columns = ["FileName","Bytes"]
values = [["ipsum.pdf",fileBytes]]
ds = system.dataset.toDataSet(columns, values)
system.tag.write("[client]MyBytes",ds)


# Get the bytes from the dataset tag
data = system.tag.getTagValue("[client]MyBytes")

pdf.loadPDFBytes(data.getValueAt(0,"Bytes"),"")
3 Likes

Thanks. I’ll have to play with this.

I appreciate all the good ideas and help.

Client startup script to check for existence of files, then copy them from the server, if needed.

1 Like

I thought about that as well… we have a few avenues to try and see what works well.