我熟悉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
答案 0 :(得分:1)
解决:事实证明你必须制作rst.pdfbox.layout.elements.Document
父母即:
Document ParentDoc = new Document();
Shape rec = new rec(10);
ParentDoc.add(rec);
//ParentDoc.getPDDocument()... use for PDFBox Items