从 Draw2D 画布创建 PDF

发布于 2024-10-05 22:35:24 字数 125 浏览 0 评论 0原文

我正在寻找一种从 Draw2D 画布构建 PDF 的方法。我相信我已经从 Java2D 中找到了一种方法来做到这一点,但在 Draw2D 中却没有。其中涉及许多图形元素(以及文本),因此我认为我无法走 XSLT 路线。有人有什么建议吗?

I'm looking for a way to build a PDF from a Draw2D canvas. I believe I've seen a way to do this from Java2D, but not Draw2D. There are many graphical elements involved (as well as text) so I don't think I can go the XSLT route. Does anyone have any suggestions?

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

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

发布评论

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

评论(2

雨的味道风的声音 2024-10-12 22:35:24

也许您可以使用“jPod”取得成功。

它附带了一个如何使用其“CSCreator”创建 PDF 内容的简单示例,该示例将 PDF 图形操作原语作为 API 发布。虽然我不使用draw2d,但我认为映射到这个API应该不难。

大致应该像这样

  • 打开/创建 PDF
  • 选择/创建页面
  • 在该页面上创建一个 CSCreator
  • 调用绘图基元
  • 关闭并保存...

Maybe you can succeed using "jPod".

It comes with a simple example how to create PDF content using its "CSCreator", which publishes the PDF graphics operation primitives as an API. While i do not use draw2d, i assume it shouldn't be to hard to map to this API.

Roughly it should go like this

  • open/create PDF
  • select/create page
  • create a CSCreator on this page
  • call drawing primitives
  • close and save...
南城旧梦 2024-10-12 22:35:24

iText 是一个用于从 java 应用程序创建 PDF 的库。 iText 实现了 Graphics2D 类的适配器,请参阅此。因此您可以将任何 AWT/Swing 组件绘制到 PDF 中。

Eclipse Graphiti 包含另一个 适配器。它将draw2d Graphics 调整为awt 的Graphics2D。您可以下载它,也许可以根据您的需要进行一些编辑。因此,使用这些适配器,您可以将根图绘制到 PDF 中。它有效,我已经尝试过。

iText is a library for creating PDF from java application. iText implements its adapter for Graphics2D class, see this. So you can draw any AWT/Swing component to the PDF.

Eclipse Graphiti contains another adapter. It adapts draw2d Graphics to awt's Graphics2D. You can download it and maybe little edit for your needs. So using those adapters you can draw your root figure to the PDF. It works, I have tried that.

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