1

I am working with PDFBox v2 and boxable and I need to generate a cell with 2 rows inside.

I tried to make like wiki explains, but in my app cell content prints literally. table

The code for generate inner table is:

activeRow.createCell(100f, "<table><tr><td> R1 </td></tr><tr><td> R2 </td></tr></table>");

What is going wrong?

Thanks!

MaiK
  • 101
  • 8

2 Answers2

2

I respond to my own question.

The problem is call to createCell(). The correct method to create inner table is createTableCell().

MaiK
  • 101
  • 8
0
     float margin = 80;
    // starting y position is whole page height subtracted by top and bottom margin
    float yStartNewPage = page.getMediaBox().getHeight() - (2 * margin);
    // we want table across whole page width (subtracted by left and right margin ofcourse)
    float tableWidth = page.getMediaBox().getWidth() - (2 * margin);

    boolean drawContent = true;
    float yStart = yStartNewPage;
    float bottomMargin = 70;
    float yPosition = 550;
   cell = row.createTableCell((100), "", document, page, yPosition , bottomMargin, margin);   

Create simple table cell inside table

  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Nov 24 '21 at 16:53