![]() There's also a question and answer that explains how to draw the rectangle, should that really be one of your requirements. These questions were selected for the book "The Best iText Questions on StackOverflow". Using ColumnText results in "The document has no pages" exception.How to fit a String inside a rectangle?.Read these questions and answers before you start implementing: However, you need to be careful and make sure that the content fits the rectangle. If rectangle is a Rectangle object defining the coordinates of the rectangle where you want to add the two paragraphs, then you need this code: ColumnText ct = new ColumnText(writer.getDirectContent()) Īs you can see, there is no need for a third paragraph. Be sure to manually delete the old (wrong) relationship you had by right clicking the class, collection editor and then relations. If I were you, I would look at my answer to the question, and use the ColumnText object:Īdding paragraphs to a rectangle is done like this: To create the <> notation, enter the name as <> IInterfaceName and then draw a realisation line between the implementing classes.You can do it the hard way, by using a sequence of low-level operations, as is done in this question: Separating redundant code from pdf generator function, but given your level of expertise, I would not advise you to do this. ![]() ![]() If you want to add text at absolute positions, for instance in a rectangle, you have two options. When you use document.add() you tell iText to position the text for you, based on the size of the page and its margins. You say you want to add these paragraphs to a rectangle, yet you are using document.add(p). Either you create one Paragraph consisting of the blueText and greenText chunks, or you create two paragraphs, and you add them to the page sequentially. ![]() You created 2 paragraphs, and you add them to a third paragraph.Īlthough you can do that, it doesn't make any sense. ![]()
0 Comments
Leave a Reply. |