Document preview generation

Hi Team,

We have a requirement in which we need to generate the preview of the document attached in the posts so that it is helpful for the user to see the preview rather than downloading the file , I am able to extract the content of the file but not able to generate the preview .

I tried{file_id}/preview endpoint but it supports only image files , we need to generate the preview for all the file types supported by mattermost.

Is there a way in which i can generate the preview ?


Hi @Geetika_Dwivedi,

Thanks for your question,

There wasn’t any document attached so I’m not sure what kind of document it is… I can view .pdf previews on our nightly build server but I believe other file-type previews are still in the works…

I see that this message was posted Dec '17. As of now, is there a way users can preview documents such as PDF, Word, Excel, and other formats before downloading?

Hi @ovim,

If you have trouble with file previews, this could be due to missing mime types. You can check mime types with

SELECT MimeType, count(*) FROM mattermost.FileInfo GROUP BY MimeType ORDER BY 2 DESC;

These are the mime types for previewing MS Office files on mobile:


Another thing to check is whether …/mime.types files are included on your base file system. More details at

I’m not 100% sure if we have full support in webapp/desktop app, but all previews should work at least on the mobile apps.

1 Like

Thank you for the information provided.