Viewing PDFs With DriveWorks Live

If I sent you a PDF, how would you open it? You’d probably use a PDF reader, but what if that’s not an option? A classic example is if you’re opening this file on your phone. While some phones (mine included) do have PDF Readers, some don’t. So, if you’re in a DriveWorks Live project and want to view a PDF, wouldn’t you want to just open it in a web browser? Ideally, yes, that makes sense, but there’s a catch. There are security protocols in both Google Chrome and Microsoft Edge that restrict opening a file on the web that’s from a server. What we’re going to walk through today is how to make sure that your users can view PDFs with DriveWorks Live without having to jump through any hoops.

The Problem with Chrome/Edge and Viewing a PDF

I’m a big fan of Google Chrome. It does a nice enough job with security, it’s easy to use, and I can connect to my Google account. But recently, I got a question from one of our DriveWorks customers. Their administrator was trying to set up a project that would let users view a PDF generated by Autopilot without having to leave the project.

My thinking was that you could use a Web Frame control and just set the URL to be “file://NewFilePathGeneratedByAutopilot“. I’ve seen Chrome do that before to open a file, surely it can do it again. Nope. Turns out, Chrome blocked it and I couldn’t fix it. So I tried a different web browser, Edge. No dice. Then I got desperate and tried Internet Explorer and it worked!

Clearly, I needed to do some research. Thanks to some digging from our support team, we had an answer. Microsoft and Google started blocking “file://” URLs sometime in the last few years. The biggest reason for it is security reasons. Someone could post a harmful document and that URL leads you right into it. Because of this, it seems we need a workaround, or maybe just a different method.

A Better Way

To view files in DriveWorks Live, just insert the FsGetUrl function in the URL rule.

We had to think of some options. The first would be that we could just have everyone use Internet Explorer and that would let anyone view the file. But what if someone didn’t want to use it? Or what if they have a device that doesn’t have Internet Explorer? Okay, then how about some kind of extension for Edge/Chrome that unblocks them? I think we’re getting closer, but that’s still a client side resolution and we can’t ask every user to install an extension.

Then we had a thought. DriveWorks Live shows documents when you run through the projects. Let’s take a look at how they do it?

Very simply, we have a function in DriveWorks called FsGetUrl. What FsGetUrl does is it retrieves a URL for a given file. Then you can take that URL and use it to display files in a web frame control or as a hyperlink to let users download a file directly from your project.

It’s easy enough to do and the results are everything you could ask for. Now you can give your users access to real time PDFs, created using DriveWorks Live.

Viewing a PDF in DriveWorks Live is easy with FsGetUrl

Final Thoughts

This does extend beyond simply a PDF. While they are one of the more common file types, you may also want to give a user access to a rendering in PNG form. You could also view an HTML file the same way.

FsGetUrl can’t display file types like SOLIDWORKS Parts, Word Documents, or Zip files. However, you can use the hyperlink method to allow the user to download his or her files right from the interface.

Lots you can do, all with one simple function.


  • Share this
Find Your Design Solution in the CATI Store.
Browse Products