gpt4 book ai didi

java - PDFBox PDDocument 添加 pdf-layout 文档?

转载 作者:行者123 更新时间:2023-11-30 10:25:48 30 4
gpt4 key购买 nike

我越来越熟悉 PDFBox 的各种风格。我想知道是否有办法将 pdf-layout 元素放入 PDDocument 对象中。 pdf-layout 元素使用 Document 作为父元素,PDFBox 使用 PDDocument 作为父元素。

PDDodcument doc = new PDDocument();
Paragraph someText = new Paragraph();
Frame shape = new Frame(someText);
//Im looking for something like doc.add(shape);

使用的库: https://pdfbox.apache.org/2.0/examples.html& https://github.com/ralfstuckert/pdfbox-layout

  • org.apache.pdfbox.pdmodel.PDDocument
  • rst.pdfbox.layout.elements.Frame
  • rst.pdfbox.layout.elements.Document

最佳答案

已解决:原来你必须制作 rst.pdfbox.layout.elements.Document parent 即:

Document ParentDoc = new Document();
Shape rec = new rec(10);
ParentDoc.add(rec);
//ParentDoc.getPDDocument()... use for PDFBox Items

关于java - PDFBox PDDocument 添加 pdf-layout 文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45943826/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com