默认标题p:带有pdf播放器的媒体 [英] Default header p:media with pdf player

查看:127
本文介绍了默认标题p:带有pdf播放器的媒体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用流式<p:media>编写<p:lightBox>来预览外部PDF.

I'm programming a <p:lightBox> with a streamed <p:media> to preview external PDFs.

它工作正常,但我遇到了一些障碍.

It works fine but i'm getting a little handicap.

呈现pdf对话框时,它会(在鼠标悬停时)显示一个标题,该标题始终显示相同的标题:"dynamiccontent.properties".

When the pdf dialog is rendered it shows (on mouse over) one Header where it always display the same title: "dynamiccontent.properties".

是否存在属性或可以覆盖以自定义的内容?

Is there an attribute or something that I can override to customize it?

JSP代码:

<p:lightBox>
  <h:outputLink value="#" title="#{myDoc.fileName}">
    <i class="fa fa-eye" aria-hidden="true"></i>
  </h:outputLink>

  <f:facet name="inline">
    <p:media value="#{documentController.stream}" width="1100px" height="600px" player="pdf">
        <f:param name="idStore" value="#{myDoc.idStore}" />
    </p:media>
  </f:facet>
</p:lightBox>

显示的PDF标头

感谢您的时间.

推荐答案

这似乎是Primefaces中的错误.检出Primefaces版本6.1,因为它们似乎已在此处修复了此问题. 然后,在DefaultStreamedContent中设置内容名称即可

This seems to be a bug in Primefaces. Checkout Primefaces version 6.1 as they seem to have fixed this issue here. Then, setting the content name in DefaultStreamedContent works

new DefaultStreamedContent(pdfData(), "application/pdf", "document.pdf");

我的<p:media>在xhtml中:

<p:media value="#{pdfViewerController.fileStream}" player="pdf" cache="false" />

渲染的<p:media>看起来像这样:

<object type="application/pdf"
        data="/javax.faces.resource/dynamiccontent.properties;/document.pdf?ln=primefaces&amp;v=6.1&amp;pfdrid=8881a099cd5419259117729be00f4824&amp;pfdrt=sc&amp;pfdrid_c=false&amp;uid=f6c9ade9-4d7b-47ab-832f-19b119e6cd58"
        internalinstanceid="9" title="">
</object>

然后,Chrome中的pdf查看器标题和下载文件名均为"document.pdf".

Then both the pdf viewer title and the download file name in Chrome are "document.pdf".

这篇关于默认标题p:带有pdf播放器的媒体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆