The web application we are working on allows users to upload text, PDF and excel files.    They can also download them and view from their desktop however I'm wondering if there is a way to view the file in the browser window instead of just downloading?   (especially for .txt and .pdf files)


Anyone have suggestions on the best way to accomplish this?

Hi Josh,

You have two components that can help you. check them here and here.

Regards,

Marcelo

Hi Josh,

Have you ever check the following component?
https://www.outsystems.com/forge/component-overview/1281/web-previewer

With best regards,
F.Karatay

When downloading a PDF or other binary file, how it's viewed on the client is a matter of what application is registered for that file type. Many browsers can now render PDF natively, but if the user has another application registered for PDFs, that application would be used instead.

If, by "view the file in the browser window" you mean rendering the PDF server-side, there may be components or services you can use for that. You could, for example, use a third-party rendering service in an iframe. Others may have additional suggestions.

For a text file, this thread may be helpful in reading the contents and displaying them on-screen:

https://www.outsystems.com/forums/discussion/42194/read-data-from-txt-file/

If all you want to do is display the text, you can either use an expression or a disabled input with the Text Lines property set for .txt files.

PDFs are a bit more complicated and might be too dependant on the browser of the user. You can try using an <embed> element in an unescaped expression, but there's already some browsers that don't support this. You can try looking into https://mozilla.github.io/pdf.js/ as a solution that will be supported everywhere.

Thanks all, I had found simpleviewer but the warning about the file size issue made my want to steer clear of that.   I'm going to give web previewer a look and see if that fits my use case.   Much appreciated!