在冰面上打印

发布于 2024-10-03 04:52:43 字数 49 浏览 0 评论 0原文

我想在冰面上打印报告,但可以找到任何合适的方法。请指导我在我的项目中实施同样的方法。

I would like to print reports in icefaces, but could got find any proper method for it. Please guide me for implementation of the same in my project.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

旧时浪漫 2024-10-10 04:52:43

我使用ice:outputResource 标签让用户下载PDF 报告文件。该标记的资源属性应指向实现 com.icesoft.faces.context.Resource 的托管 bean 属性。

I've used the ice:outputResource tag to let the user download a PDF report file. The resource attribute of that tag should point a managed bean property that implements com.icesoft.faces.context.Resource.

り繁华旳梦境 2024-10-10 04:52:43

JOTN 获得想法后,我终于能够将其组合在一起。

我们可以使用outputresource标签链接到任何类型的资源,不仅是静态资源,还可以是动态生成的文件(即时)。

让我们看一下下面的示例:

JSF 页面:

..
..
<ice:outputResource id="outputResource1" attachment="false" fileName="File1.pdf" label="Click to download attachment" mimeType="application/pdf" rendered="true" resource="#{ReportParam01.reportfilers}" shared="false"/>
..
..

这里我观察到,直到文件实际生成(在动态文档的情况下)之后,输出资源链接才会出现。

假设我们希望动态生成 pdf 文件。以下步骤将其链接到上述输出资源。

托管Bean:

public class....{
     ....
     // This is the resource linked to the <ice:outputresource> tag.
     // Encapsulation has been done to link it.
     Reource reportfilers; 
     ....

     public void createDocument() {
         Document reportDoc = new Document(PageSize.A4);
         File file1 = new File("Report.pdf");
         PdfWriter.getInstance(reportDoc, new FileOutputStream(f));
         // writing to pdf code continues
         reportfilers = new FileResource(file1);
     }
     ....
     ....
}

调用上述方法(如果没有例外)将使链接显示出来,用户可以下载文件。

after getting idea from JOTN I'm finally able to put it together.

We can use the outputresource tag to link to any type of resource, not only static ones but also dynamically generated files(on the fly).

Let us have a look at the following example:

JSF Page:

..
..
<ice:outputResource id="outputResource1" attachment="false" fileName="File1.pdf" label="Click to download attachment" mimeType="application/pdf" rendered="true" resource="#{ReportParam01.reportfilers}" shared="false"/>
..
..

Here I've observed that the outputresource link won't appear until the file is actually generated(i case of on the fly documents).

Let us assume we wish to generate a pdf file dynamically. The following steps will link it to the above mentioned outputrespurce.

Managed Bean:

public class....{
     ....
     // This is the resource linked to the <ice:outputresource> tag.
     // Encapsulation has been done to link it.
     Reource reportfilers; 
     ....

     public void createDocument() {
         Document reportDoc = new Document(PageSize.A4);
         File file1 = new File("Report.pdf");
         PdfWriter.getInstance(reportDoc, new FileOutputStream(f));
         // writing to pdf code continues
         reportfilers = new FileResource(file1);
     }
     ....
     ....
}

Calling the above method (if it has no exceptions) will make the link to show up and the user can download the file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文