在应用程序内创建 PDF/Word (Doc) 文件

发布于 2024-10-07 12:22:58 字数 209 浏览 0 评论 0 原文

是否有一种确定的方法可以在应用程序中创建 PDF 或 MS Word 文档文件并立即通过电子邮件发送(也可能存储它)。

我已经尝试了一段时间并找到了JAVA库:apwlibrary和iText。但他们都不提供任何类型的教程。

有人能指出我正确的方向吗?

编辑:想一想,是否可以使用在线 PDF 生成器,首先将数据发送到服务,然后检索结果并将其保存在手机上?

Is there a definitive method of creating either a PDF or a MS Word Doc file within the app and email it immediately (and possibly, also store it).

I have been trying for quite some time and have found out the JAVA libraries: apwlibrary and iText. But both of them dont provide any tutorials of sorts.

Could anyone point me in the right direction?

EDIT: Come to think of it, is could an online PDF generator be used, first by sending the data to the service, then retrieve the result and save it on the phone?

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

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

发布评论

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

评论(4

场罚期间 2024-10-14 12:22:58

我推荐 apache fop http://xmlgraphics.apache.org/fop/
您可以使用标准 FOP 生成 pdf。

I would recommend apache fop http://xmlgraphics.apache.org/fop/
you can use standard FOP to generate pdf.

深海少女心 2024-10-14 12:22:58

除非创建 pdf 文件是您设备的核心功能,否则我建议不要自己创建。添加 PDF 创建可能会需要大量工作,具体取决于您的性能需求。 Java 库将更容易添加,但性能较差。与 Java 相结合的本机库将更加难以维护构建和错误修复。

如果您只需要通过电子邮件发送一些信息,为什么不在 html 中创建消息文本并使用意图通过内置电子邮件程序通过电子邮件发送它呢?或者,如果您愿意,您可以将 PDF 生成放在服务器上,然后通过电子邮件发送链接。

Unless it is a core feature of your device to create a pdf file I would suggest not to do it yourself. Adding PDF creation is going to be quite a lot of work potentially depending on your performance needs. Java libraries will be easier to add but less performant. Native libraries combined with Java will be more hazzle to maintain build and bug fixing wise.

If you just need to email some information why dont you create a message text in html and use a intent to email it with the build in email program instead? Or if you want you could e.g. put the PDF generation on a server and just email a link..

╄→承喏 2024-10-14 12:22:58

我现在正在使用 JasperReports,这是一个开源库,用于用 Java 创建报告并将其导出为 PDF、DOC、XLS...将其与 iReport 结合使用来创建一组模板,可以非常轻松地创建填充的文件包含来自不同类型来源的内容(我正在使用 JavaBeans)。

如果您不喜欢静态模板的想法(根据您的需要,这有点烦人),您可以随时查看 DynamicJasper(网站上的示例很棒)。
祝你好运!

I'm working right now with JasperReports, an open source library to create reports in Java and export them to PDF, DOC, XLS... Using it in conjunction with iReport to create a group of templates makes it really easy to create files filled with content from different types of sources (I'm using JavaBeans).

If you don't like the idea of having static templates (That's a bit annoying depending on your needs), you can always take a look at DynamicJasper (The examples on the website are great).
Good Luck!

等风来 2024-10-14 12:22:58

我使用过 Apache POI。看起来效果很好。 http://poi.apache.org/

实际上,http://poi.apache.org/hwpf/

I have used Apache POI. It seemed to work well. http://poi.apache.org/

This actually, http://poi.apache.org/hwpf/

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