[Web Previewer] Pdf previewer shows "No Preview Available"

Forge Component
(18)
Published on 2018-11-19 by Rui Mendes
18 votes
Published on 2018-11-19 by Rui Mendes

Hi everyone, We are trying to preview the binary content that we generate in the app before the user downloads the file.We have a preview block on the screen as it is assigned with the properties as shown below. 

The preview button when pressed triggers a screen action that assigns the File attributes and refreshes the widget as shown below

But when we publish and execute it, we get a error stating as below

Any help is appreciable!

Thank you,

Abhi

Hello,


1st Option :

First we need to take the dependency of RunJavaScript server action which is present in HttpRequestHandler.

Just Drag and drop the Run Server Action search for RunJavaScript server action in the screen action.

And in the script enter "window.print()" and this will preview 



2Nd Option :

 you can use SimpleViewer Forge Component.


link :- https://www.outsystems.com/forge/component-overview/3526/simpleviewer

Hi Abhinav,

Everything looks ok from your side. Did you debug and checked that all the fields have the correct data? instead of preview were you able to download that file?

Regards,

Marcelo

Marcelo Ferreira wrote:

Hi Abhinav,

Everything looks ok from your side. Did you debug and checked that all the fields have the correct data? instead of preview were you able to download that file?

Regards,

Marcelo

Hi Marcelo,


Yes, the download function works fine on the binary data. So we just wanted the users to preview the data before they download the file. 

To debug it in a better way, I made a small app where I can upload the file and view it by the previewer. When I upload any .png or .jpeg images, it works fine but when I upload a .pdf, the result is same as above with "No preview available"

Hope you can understand the whole scenario now! Any help would be appreciated.


Thank you!


Solution

Hi Abhinav,

Your application is available to the internet? This is one of the limitations of this component. One of the pages on the component that exposes the file to gview or officeapps needs to be available publicly. If your application isn't publicly available the component will not work. If you read the details is there "This component requires an open internet connection."

Regards,

Marcelo

Solution

Marcelo Ferreira wrote:

Hi Abhinav,

Your application is available to the internet? This is one of the limitations of this component. One of the pages on the component that exposes the file to gview or officeapps needs to be available publicly. If your application isn't publicly available the component will not work. If you read the details is there "This component requires an open internet connection."

Regards,

Marcelo

Hi Marcelo,

Thank you for the clarification on the dependency! Unfortunately, the app is not publicly available. We will try to find another forge component or custom build the JS function to display it. Thank you for the support.


Best regards,

Abhinav