cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can change your system assigned username to something more personal in your community settings. X

Regarding PDF view

DMu3
12-Amethyst

Regarding PDF view

Hii,
Actually i created mashup, I want to display a pdf file in a mashup (webframe), but the problem is that when i click on a grid i download the pdf file instead of display it in a webframe. Can u help me to do that.. I attached my screenshot below.

7 REPLIES 7
Constantine
17-Peridot
(To:DMu3)

Hello @DMu3,

 

You're asking two questions:

 

  1. How to fix the HTTP 404 error? For this you need to bind downloadLink as the webframe URL, not the filename or path.
  2. How to display the PDF in the webframe instead of downloading it? It's a popular question on this website, you should be able to find few existing suggestions. Here's a recent example: https://community.ptc.com/t5/ThingWorx-Developers/Display-a-pdf-file-in-mashup/m-p/645592

 

Regards,
Constantine

DMu3
12-Amethyst
(To:Constantine)

Hello,
Thank you for your reply,.
Where i have to give this code?  I used service that is GetFileListingWithLinks. 

location ~* /(.*\.pdf) {
        proxy_hide_header       Content-Disposition;
        add_header              Content-Disposition "inline";
        ... the rest of redirect config ...
} 

 

DMu3
12-Amethyst
(To:Constantine)

Hello,
I don't know how to use that code. Can you explain that where i have to give that code and how to fix that issues?

Constantine
17-Peridot
(To:DMu3)

This is not code, it's an example of NGINX configuration file, in case you use it as a reverse proxy.

 

/ Constantine

DMu3
12-Amethyst
(To:Constantine)

Hi,
okay, I set this link in my url, 
http://<host>:<port>/Thingworx/FileRepositoryDownloader?download-repository=<RepositoryName>&directRender=true&download-path=/my%20file.pdf
But, I can't able to view my pdf file, and I attached my screenshot below,

DMu3
12-Amethyst
(To:DMu3)

Hii,

Actually, i tried to fix this issues, then also i can't able to view pdf file.  I attached my screenshot below.  Can you help me to finish this one.  

Constantine
17-Peridot
(To:DMu3)

Hello @DMu3,

 

There are several issues with this approach -- mainly because you need to hardcode server hostname in your application. There's a better way -- try this:

var result = Things["TestDrive"].GetFileListingWithLinks({
	path: '/',
	nameMask: code + '.pdf'
}).downloadLink;

If it gives you similar errors, then try to press F12 and see where this error comes from -- you should be able to see the failing HTTP request and identify the issue by looking at returned error message. You should be able to find equivalent information in the Script and Application logs in ThingWorx as well.

 

/ Constantine

Announcements


Top Tags