[Question] PDF Viewer File Path

The source for the PDF can you use a file path??

Remember that we’re operating in a browser environment now, so the browser is only able to load things up that are served up over HTTP. This means that the source of the PDF needs to be a URL.

If you have PDFs on a filesystem that the gateway can access, you might need to use WebDev to stream the PDF bytes over HTTP.

1 Like

Is there any documentation available on how this might be achieved? I have several PDF’s on my gateway PC that I would like to be able to embed into a Perspective view.

https://docs.inductiveautomation.com/display/DOC80/Perspective+-+PDF+Viewer

Remember that paths are relative to project, so placing the .pdf file within a project directory of MyProject/PDFFiles and naming the file MyPDF.pdf should have a path like ‘/PDFFiles/MyPDF.pdf’ when being used within the MyProject project.

I’m going to recuse myself from answering this question because even I don’t fully understand how to use a .pdf in Perspective. In speaking with Development, it sounds like any .pdf file would have to be served up by the Gateway, which would mean you would need to be using the WebDev Module to serve the .pdf by placing it into a mounted folder. You would then supply the path to the file. I’ll ask around and try to get some more information, but you’d probably be best-served by getting someone else to answer this question.

1 Like

I found the manual page for the Perspective PDF Viewer component, but it doesn’t yet have any details on the correct path.

I’ve tried putting a folder called ReferenceDocuments in C:\Program Files\Inductive Automation\Ignition\data\projects\[project name], and put a PDF file in there called Test.pdf. I’ve then made the source for the PDF viewer \ReferenceDocuments\test.pdf, and I’m still just getting the “failed to load PDF file” error. Have I got the wrong project directory, or am I doing something else wrong?

The thing about the PDF viewer in Perspective is that it must be served via an HTTP request like Carl said above and cannot use the path on the file system. Luckily, this can be easily achieved using the webdev module with these simple steps:

  1. In the designer, under the Web Dev context, create a File Resource
  2. Select your PDF and save it
  3. Now this creates the PDF as a web resource located at http://host:port/main/system/webdev/project_name/resource_name
  4. Now go back to Perspective and in the PDF viewer source property, you should be able to enter something like /system/webdev/project_name/resource_name

I’ve attached a simple project to this comment with a sample PDF viewer using a webdev PDF file.PDF_Test.zip (12.7 KB)

4 Likes

Thanks, that clears it up, I’ll give it a try when I’m back in the office.

Is the Web Dev context you’re referring to the “Web Development Module” available as a separate module, or is there a webdev module of some kind built into the perspective module? I haven’t yet organised the purchase of a license for my application, so if it’s a separate module I’ll just have to shoot my rep an email and get it added in to my quote.

It is a separate module, located here under “Device Connectivity”.

1 Like

So there will be no file access with Perspective from the clients?
We use a ton of files for all kinds of different things in Vision, this will be a deal breaker for us. :frowning:

There’s literally no way around it - it’s just the way file access works in web browsers. At some point we may streamline that webdev process, but it’s dangerous to expose files on the gateway to every web browser that happens to connect to Ignition. Making it harder makes it less likely someone does something by mistake that causes them lots of problems down the road.

Can you describe your usage of files a bit more? Files stored where? Used for what purpose?

Oh boy where to start…
We download xml files using Oracle web methods and then process them.
We create xml files and process them.
We create PDF files, edit PDF files, email them around, store them, view them, etc.
We parse Rockwell L5k and L5x files and then generate XML tag imports for use in Ignition.
We parse Wonderware tag DB Dump CSV files and create XML tag import files.
We parse and create tags from a proprietary system to Ignition and our databases.
We capture, edit and store image files from Cognex cameras.
We create, edit, and view PDF Lockout/Tagout files, VWI files, images for those.
That’s just off the top of my head, there is more.
@Paul.Scott is familiar with our systems and the complexity of them.

IA is not getting rid of Vision – at least not for several years, so I have been assured. Running super complex, custom tasks in a web browser is not something easily supported in a secure way. Your list is likely to be Vision-only for quite a while yet. And some may never get to Perspective.