是否可以使用primefaces的数据导出器将编辑器数据导出为pdf。
我试着用下面的代码,但它不起作用。
<p:editor value="#{mailBean.mail}" id="editor">
</p:editor>
<p:commandLink>
<p:graphicImage value="/images/pdf.gif" />
<p:dataExporter type="pdf" target="editor" fileName="files" pageOnly="true"/>
</p:commandLink>发布于 2012-06-04 18:51:18
不,不是的
从用户指南中:
DataExporter可以方便地将使用Primefaces数据表列出的数据导出为各种格式,如excel、pdf、csv和xml。
有关用户指南的更多信息
目标必须指向PrimeFaces数据表
编辑
你可以尝试的是:在你的项目中集成TinyMCE编辑器,看看这个线程HTML to PDF demo,这是一个直接链接的WYSIWYG Editor Export to PDF
发布于 2013-02-05 23:14:32
数据导出器的发布器按钮一定不能是ajax,目标值应该是指一个数据表,还需要itext2.1.7可选的DataExporter (PDF) *apache poi 3.7可选的DataExporter*库(Excel).
即使它们是正确的,数据导出器还不稳定,这取决于您的数据表。例如,当您使用具有列组的动态列时,它不能导出数据。
我更喜欢使用itext库导出您自己的文档,它也更灵活。
祝好运!
发布于 2014-01-21 19:49:15
如果目标必须指向一个PrimeFaces数据表,那么下面的代码是如何可能的,这是来自PrimeFaces站点。(http://www.primefaces.org/showcase/ui/chartExport.jsf)
<p:lineChart value="#{chartBean.linearModel}" legendPosition="e" zoom="true"
title="Linear Chart" minY="0" maxY="10" style="width:500px;height:300px" widgetVar="chart"/>
<p:commandButton type="button" value="Export" icon="ui-icon-extlink" onclick="exportChart()"/>
<p:dialog widgetVar="dlg" showEffect="fade" modal="true" header="Chart as an Image">
<p:outputPanel id="output" layout="block" style="width:500px;height:300px"/>
</p:dialog>
function exportChart() {
//export image
$('#output').empty().append(PF('chart').exportAsImage());
//show the dialog
PF('dlg').show();
}这里的源文件是一个图表,使用exportChart()函数将导出的数据作为image.that导出,这意味着我们可以导出任何数据,而不仅仅是原始数据表。
https://stackoverflow.com/questions/10879997
复制相似问题