0

I have used the following in xhtml:

<pe:documentViewer id="documentViewer" height="380"
            value="#{myBean.fileContent}" />

and in Bean:

byte[] downloadedFile =handleFileDownload(id);

    fileContent = new DefaultStreamedContent(new ByteArrayInputStream(
            downloadedFile));

Using this code I am able to view the PDF files, but how do I view other documents like, doc,docx,txt,xsl and xslx?

Harihara_K
  • 174
  • 16
  • 3
    Correct, the PE documentviewer just does not support this. Nor will it (unless you find an open source javascript library that can do this and then file a pull request in the PrimeFaces Extensions issue list). How you should show one in the browser should be done the same way as with plain html (but the client-side needs to have a viewer for this) – Kukeltje Jun 23 '20 at 12:18
  • 2
    e.g. do like https://stackoverflow.com/questions/2832715/downloading-excel-file-from-server-using-servlets – Kukeltje Jun 23 '20 at 15:11

0 Answers0