Reading a document from backend to UI

I want to read pdf/.docx file content on UI and my file should not be visible on front end. Is it possible?

  Discussion posts and replies are publicly visible