1

I'm on PF 6.2 and trying to use the p:media component for displaying PDFs.
(I shifted from using pe:documentViewer only because it currently doesn't display digital signatures, since PDF.js doesn't support that feature in the first place).

However, I observe that the look-n-feel of the rendered PDF viewer is different across browsers.

My usage:

<p:media id="pdfVw" height="600" width="800" value="#{viewerController4.pdfDocumentStream}" player="pdf" cache="false">                                              
        <f:param name="id" value="#{viewerController4.currentDocId}" /> 
</p:media>

In the backing bean:

public StreamedContent getPdfDocumentStream() throws IOException {
        FacesContext context = FacesContext.getCurrentInstance();

        if (context.getCurrentPhaseId() == PhaseId.RENDER_RESPONSE) {
            return new DefaultStreamedContent();
        } else {
            String id = context.getExternalContext().getRequestParameterMap().get("id");
            Doc doc = pdfDocMap.get(id);

            return new DefaultStreamedContent(new FileInputStream(new File(doc.getDocPath())), "application/pdf", doc.getDocName());
        }

    }

About the look-n-feel...for example, in Chrome:
* no thumbnail strip for the pages!
* that string "Microsoft word-Dokument1" is coming from the PDF's "title" attribute (I wish I could suppress displaying it !)

enter image description here

In Firefox:
* the thumbnail strip is there
* the digital signature is gone!
* that title string is not there (for me, it's a plus)
* the menus are also completely different compared to Chrome enter image description here

(In IE, it's even more different)

My client's target browser is Chrome.
If I could somehow suppress that title and start showing the thumbnail strip in Chrome, that would solve my purpose entirely. Any advice?

Tatha
  • 131
  • 1
  • 13
  • Here's you can find how to configure some [customizations](https://brazeebrazee1.blogspot.com/2015/01/jsf-jsf20-show-certain-pdf-page-on-load.html) (toolbar->0 hide the toolbar, it's the closest option I've found, although it's a solution a bit drastic, but as reported `Different proprietary players might have different configuration parameters`) – WoAiNii Apr 26 '20 at 10:23
  • Also as a note Firefox's PDF renderer is PDF.js so that explains why the digital signature is gone. PDF.js is a Mozilla project specifically for rendering PDF's in the Firefox browser. – Melloware Apr 26 '20 at 12:05
  • 1
    @Melloware Thanks a lot for that info. I wouldn't chase behind any renditions of PDF on Firefox then. – Tatha Apr 26 '20 at 19:16
  • @WoAiNii As you advised, this `` vanishes the entire toolbar itself. But individually, I haven't had any luck suppressing the title alone. I realized, at least for Chrome, the title in the toolbar comes from the PDF's _"title"_ metadata. So, if I want to display a title same as the file name, then one option could be to edit the original PDF itself, before displaying it -- but that wouldn't be a good solution (though it works actually). – Tatha Apr 26 '20 at 19:31
  • If I could know what other `` config values could be passed to `` for Chrome for PDF player, it would have been some hope ...but I couldn't locate any documentation on this :( – Tatha Apr 26 '20 at 19:35

1 Answers1

0

I came to know....to expect the thumbnail strip in Chrome would be a wrong expectation, while using p:media. This is because, while with p:media, Chrome would use its own PDF viewer and not Adobe's (so, there may not be all Adobe like features available). More here: https://community.adobe.com/t5/acrobat/adobe-acrobat-features-not-showing-up-in-chrome/td-p/10480323?page=1

On the topic of the title getting displayed on the toolbar, I still couldn't find any solution to easily suppress or soft-modify it, other than editing the title metadata of the PDF itself.

Also, came across this nice document that lists the various <f:param> that can be passed to configure viewers :)
https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf

Tatha
  • 131
  • 1
  • 13