When using openpdf, can I add a Paragraph in the Paragraph with style attributes?

154 views Asked by At

When I add a paragraph in the paragraph, some style attributes including alignment are not applied to the paragraph inside. I need it to use a paragraph with a title and body and use it repeatedly. (iText5 works well. however openpdf does not work.)

OpenPdf Code

Paragraph paragraph = new Paragraph();
paragraph.add("OUTER");
paragraph.add(Chunk.NEWLINE);
Paragraph innerParagraph = new Paragraph();
innerParagraph.add("INNER");
innerParagraph.setAlignment(Element.ALIGN_RIGHT);
paragraph.add(innerParagraph);

Document document = new Document();
document.add(paragraph);

Expect

OUTER
                                    INNER

Result

OUTER
INNER
0

There are 0 answers