The NavigationMixin solution should work as well, with minor modification. According to this [blog post][1], rather than using NavigationMixin.Navigate with *type* argument **standard__namedPage** and ContentDocumentId, you should be using **standard__webPage** along with the file URL. previewFile(file){ if(!this.usedInCommunity){ this[NavigationMixin.Navigate]({ type: 'standard__namedPage', attributes: { pageName: 'filePreview' }, state : { selectedRecordId: file.ContentDocumentId } }); } else if(this.usedInCommunity){ this[NavigationMixin.Navigate]({ type: 'standard__webPage', attributes: { url: file.fileUrl } }, false ); } } [1]: https://www.sfdcpanther.com/how-to-preview-files-in-lightning-community-using-lwc/