Skip to content

Error: "Table cell is too big to be rendered" when generating PDF #414

Open

Description

@NZQN23

When generating a PDF inside a do/catch block I sometimes get the error

Table cell is too big to be rendered: TPPDF.PDFTableCell

This happens during PDFGenerator(document: document).generate(to: outputURL).

In which situations does this error occur, and what is the recommended way to handle it (e.g. for cells with large amounts of text or content)?

Thanks!

Activity

  1. brendand commented on Oct 29, 2025

    @brendand
    Contributor

    I would like to know the solution to this also. It would be nice if it could automatically truncate the content if it's too large to render in a cell.

  2. philprime commented on Dec 23, 2025

    @philprime
    Member

    Hey everyone, sorry for the long delay, notifications got lost in my inbox.

    In which situations does this error occur, and what is the recommended way to handle it (e.g. for cells with large amounts of text or content)?

    The error is used here:

    // If none of the cells fit on the current page, the algorithm will try again on the next page
    // and if it occurs again, an error should be thrown
    if onPageCells.isEmpty && !firstPage, let firstInvalidCell = nextPageCells.first {
    throw PDFError.tableCellTooBig(cell: firstInvalidCell.cell)
    }

    During table layout, TPPDF measures each cell. If a cell’s required height is larger than the remaining printable height on the page and the library cannot split the row/cell across pages, PDFTableObject throws tableCellTooLarge (“Table cell is too big to be rendered: TPPDF.PDFTableCell”).

    Typical causes for this are cells with a lot of text or tall content (e.g., big images, long unbreakable words/URLs) that won’t fit in the remaining space on the current page; very large fonts/padding; or a row whose minimum height is larger than the full page’s drawable area (inside margins), making it impossible to place even on an empty page.

    Without knowing your document setup I can't pinpoint it, but I assume it's caused by images being too large (which is unclear how that should be handled)

    Also see #405

  3. NZQN23 commented on Dec 23, 2025

    @NZQN23
    Author

    Thanks for getting back to this. In my opinion, cropping the cell (respectively its content) would be better than throwing an error.

  4. brendand commented on Jan 25, 2026

    @brendand
    Contributor

    It would be awesome to be able to specify a maximum height for a table row so that cells with a lot of text get truncated instead of throwing an error. I just got an email from a customer about this today. I had to tell them the PDF engine I'm using doesn't support large text blocks within table cells. Would be great to have a solution for this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions