1140
Views
20
Comments
How to preview a pdf/word file without download it?

Hi All,

I want to ask, how can I preview the file without download it? the file type can be in PDF/Word/Excel. And if you ok, please give me an example about how to do it.  

Thank you


Regards,

Riesta

2018-10-29 08-31-03
João Marques
 
MVP

Hi Riesta,


There is a component called Reactive Web Previewer which allows you to preview documents in Reactive applications.

It also includes a Demo where you can test and see how to implement it.


Hope it helps.


Cheers,

João

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi Riesta,


There is a component called Reactive Web Previewer which allows you to preview documents in Reactive applications.

It also includes a Demo where you can test and see how to implement it.


Hope it helps.


Cheers,

João

 Hi Joao,

Can this be used for traditional web?


Regards,

Riesta

2020-06-04 15-38-19
Samiksha Manekar
2020-06-04 15-38-19
Samiksha Manekar

Samiksha Manekar wrote:

Hi Riesta,

You can refer this.

https://www.outsystems.com/forums/discussion/65560/want-to-view-microsoft-excel-file-in-outsystems/

Regards,

Samiksha


Above link is works for traditional app .


 

2018-10-29 08-31-03
João Marques
 
MVP

Hi Riesta,


For Traditional Web, you can use the Web Previewer and you even have this sample to see how it works.


Hope it helps.


Cheers,

João

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi Riesta,


For Traditional Web, you can use the Web Previewer and you even have this sample to see how it works.


Hope it helps.


Cheers,

João

 Hi Joao and Nordin,

I've try using web previewer, in this link, said "To preview Binary Data Files, set the File input parameter and keep the URL as an empty string (""). " 

I already follow the instruction, but, why it's still error?  

 

Thank You

Regards,

Riesta

2018-10-29 08-31-03
João Marques
 
MVP

Hi riesta,


You need to pass a parameter of the type Binary (the file itself) and it seems you are passing an id.


Cheers,

João

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi riesta,


You need to pass a parameter of the type Binary (the file itself) and it seems you are passing an id.


Cheers,

João

 

 Hi Joao,

Is it like this ? But it's still error and warning.

Thanks


Regards,

Riesta

2018-10-29 08-31-03
João Marques
 
MVP

Hi riesta,


Now that I'm looking to the component it asks for an input of type File structure. That being said, when you hover the left side of the File parameter, you'll see a +.

Once you you click, it will expand into the attributes

Now you can fill the Filename, the Binary in the BinaryData parameter and on the FileType, you should fill the following depending on the type of document:


  • Word document: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • Excel document: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Powerpoint document: application/vnd.openxmlformats-officedocument.presentationml.presentation
  • PDF document: application/pdf
  • Image. image/png


The types above are the mime types, these are some examples but you can search more on the internet about them.


Hope it helps.


Cheers,

João

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi riesta,


Now that I'm looking to the component it asks for an input of type File structure. That being said, when you hover the left side of the File parameter, you'll see a +.

Once you you click, it will expand into the attributes

Now you can fill the Filename, the Binary in the BinaryData parameter and on the FileType, you should fill the following depending on the type of document:


  • Word document: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • Excel document: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Powerpoint document: application/vnd.openxmlformats-officedocument.presentationml.presentation
  • PDF document: application/pdf
  • Image. image/png


The types above are the mime types, these are some examples but you can search more on the internet about them.


Hope it helps.


Cheers,

João

 Hi Joao,

But now the problem is, the file can't be preview. 

 Thanks


Regards,

Riesta

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi riesta,


Now that I'm looking to the component it asks for an input of type File structure. That being said, when you hover the left side of the File parameter, you'll see a +.

Once you you click, it will expand into the attributes

Now you can fill the Filename, the Binary in the BinaryData parameter and on the FileType, you should fill the following depending on the type of document:


  • Word document: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • Excel document: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Powerpoint document: application/vnd.openxmlformats-officedocument.presentationml.presentation
  • PDF document: application/pdf
  • Image. image/png


The types above are the mime types, these are some examples but you can search more on the internet about them.


Hope it helps.


Cheers,

João

 

 Hi Joao,

FYI, if I view image file, it's work. but, if I view PDF/Word/Excel file, it can't. 

Thank's

Regards,

Riesta

2018-10-29 08-31-03
João Marques
 
MVP

Have you set the parameter FileType with the values I mentioned according to the type as I mentioned above?

The parameter needs to be filled according to the type of the file.


  • Word document: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • Excel document: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Powerpoint document: application/vnd.openxmlformats-officedocument.presentationml.presentation
  • PDF document: application/pdf
  • Image. image/png


Cheers,

João

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Have you set the parameter FileType with the values I mentioned according to the type as I mentioned above?

The parameter needs to be filled according to the type of the file.


  • Word document: application/vnd.openxmlformats-officedocument.wordprocessingml.document
  • Excel document: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
  • Powerpoint document: application/vnd.openxmlformats-officedocument.presentationml.presentation
  • PDF document: application/pdf
  • Image. image/png


Cheers,

João

 

 Hi Joao,

Sorry for the late reply. I've assign it to be like this. 

Thanks


Regards,

Riesta

2018-10-29 08-31-03
João Marques
 
MVP

Hi riesta,


Which values do you have in the database on the table Attachment, on the attribute FileType for the files that you are failing to preview?

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi riesta,


Which values do you have in the database on the table Attachment, on the attribute FileType for the files that you are failing to preview?

 

 Hi Joao,

I failed to preview in PDF, Word and excel file type. If I preview in PNG file type, it's succes. 

Thanks


Regards,

Riesta

2018-10-29 08-31-03
João Marques
 
MVP

Hi riesta,


What I meant was that if it is not working for the other types of documents is because your FileType value is not a correct mime type.

Since you are filling the parameter from the database, you can check what you have in the database for the table Assignment. In order to do that, you right click the table Assignment on the tab and select option View Data:

When you do that, you will see the records you have in your table Attachment (in my screenshot empty but on your with results) and you can see if the FileType is correct according to the examples I showed you:

If your file is of type PDF, then your FileType field in the database should be application/pdf in order to work, and for the Excel and Word like I mentioned above.


Cheers,

João

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi riesta,


What I meant was that if it is not working for the other types of documents is because your FileType value is not a correct mime type.

Since you are filling the parameter from the database, you can check what you have in the database for the table Assignment. In order to do that, you right click the table Assignment on the tab and select option View Data:

When you do that, you will see the records you have in your table Attachment (in my screenshot empty but on your with results) and you can see if the FileType is correct according to the examples I showed you:

If your file is of type PDF, then your FileType field in the database should be application/pdf in order to work, and for the Excel and Word like I mentioned above.


Cheers,

João

 Hi Joao,

This is the value of fileType in my database. 

 Thanks


Regards,

Riesta 

2018-10-29 08-31-03
João Marques
 
MVP

Hi Riesta,


With empty values, it is not going to work, right?

Working with the sample, I manage to upload a PDF file and have it working as you can see on the image below (I just uploaded the file and then clicked on the name of the file):


So, if you are using the same code and it is only working for images, it is something to do with data.

I think now the best thing you can do is to debug and see which mime types work for your files.


Cheers,

João

UserImage.jpg
riesta kristianti tannia

João Marques wrote:

Hi Riesta,


With empty values, it is not going to work, right?

Working with the sample, I manage to upload a PDF file and have it working as you can see on the image below (I just uploaded the file and then clicked on the name of the file):


So, if you are using the same code and it is only working for images, it is something to do with data.

I think now the best thing you can do is to debug and see which mime types work for your files.


Cheers,

João

 

 Hi Joao,

I tried to preview not with the empty data. I tried preview with the attachment ID that have value in FileType from the DB. I already debug. And when I did it, the file type, binary and the file name can be detect and have a value. But, I don't know why in the web previewer in browser always show message "Unavailable preview" when I show PDF, word and excel file type. 

Thanks


Regards,

Riesta

UserImage.jpg
Sonali Verma

Hii,

@riesta kristianti tannia 

You can try below OML logic.

Preview Document.oml
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.