0

是否可以使用 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>
4

3 回答 3

0

如果目标必须指向 PrimeFaces 数据表,那么下面的代码如何可能来自 primeface 站点。(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() 将导出的数据作为图像。这意味着我们可以导出任何数据,而不仅仅是 primeface 数据表。

于 2014-01-21T11:49:15.067 回答
0

数据导出器发布者按钮不得 ajax,目标值应参考数据表,还需要itext 2.1.7 可选 DataExporter (PDF) * apache poi 3.7 可选 DataExporter * 库 (Excel)..

即使它们没问题,数据导出器还不稳定,这取决于您的数据表。例如,当您将动态列与列组一起使用时,它无法导出数据。

我更喜欢使用itext库导出您自己的文档,它也更灵活。

祝你好运!

于 2013-02-05T15:14:32.493 回答
0

不,这不对

来自用户指南:

DataExporter 可以方便地将使用 Primefaces 数据表列出的数据导出为各种格式,例如 excel、pdf、csv 和 xml。

更多来自用户指南

目标必须指向 PrimeFaces 数据表

编辑

您可以尝试的是:在您的项目中集成TinyMCE编辑器并查看此线程HTML 到 PDF 演示,这是一个直接链接WYSIWYG 编辑器导出到 PDF

于 2012-06-04T10:51:18.200 回答