iText: set cell height during CellEvent
<p>I'm using iText to create a PDF with a table. The table headers have 90 degree rotated text, which I'm adding using a CellEvent (code below). This works great, except when the table spans multiple pages the rotated cell header text flows off the top of the page. </p>

<p>I've tried setting <strong>cell.setFixedHeight(100)</strong> but it doesn't seem to affect the cell. I've tried <a href="https://stackoverflow.com/questions/15414923/rotate-paragraphs-or-cells-some-arbitrary-number-of-degrees-itext">this solution</a> as well but I can't get the cell to display the resulting image with text at all. </p>

<pre><code>    @Override
public void cellLayout(PdfPCell cell, Rectangle position, PdfContentByte[] canvases) {

    PdfContentByte canvas = canvases[PdfPTable.TEXTCANVAS];

    try {
                    canvas.setFontAndSize(BaseFont.createFont(BaseFont.HELVETICA_BOLD, BaseFont.WINANSI, false), this.fontSize);
    } catch (DocumentException | IOException e) {
        e.printStackTrace();
    }

    if (this.alignment == PdfPCell.ALIGN_CENTER) {
        this.left = ((position.getRight() - position.getLeft()) / 2 );
    }
    else if (this.alignment == PdfPCell.ALIGN_MIDDLE) {
        this.top = ((position.getTop() - position.getBottom()) / 2 );
    }
    canvas.showTextAligned(this.alignment, this.text, position.getLeft() + this.left, position.getTop() - this.top, this.rotation);
}
</code></pre>

<p>Here's what the cell header overflow looks like. In this example it should have the month and year (Mar 2016) displayed. </p>

<p><a href="https://i.stack.imgur.com/wFKBR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wFKBR.png" alt="enter image description here"></a></p>

<p>I'd like to have the cell to be arbitrary height dependent on the actual header text being used. Any ideas on how to solve this?</p>