Skip to content

Empty spaces between rows #1613

Open
Open

Description

@monolithed

Bug Report

Image Image Image

Description of the problem

I've noticed two very strange issues with the tables:

  1. If a row doesn't fit entirely on the page, it gets fully pushed to the next page, creating empty spaces.
  2. If the text is too long to fit, it gets cut off with an ellipsis.

I would appreciate it if anyone knows how to fix these problems.

Code sample

this.document
    .table({
        debug: true,
        defaultStyle: {
            border: 0,
        },
        rowStyles: {
            padding: {
                right: 10
            }
        },
        columnStyles: [80,   '*'],
        data: [
            [
                {
                    rowSpan: 2,
                    text: 'LEFT_COLUMN'
                },
                'RIGHT_COLUMN'
            ]
        ]
    });
});

Your environment

  • pdfkit version: 0.17

Activity

  1. hollandjake commented on Apr 23, 2025

    @hollandjake
    Contributor
    1. This was intentional behaviour to ensure the borders of the cell render correctly.
    2. This issue should be fixed by Fix precision rounding issues in LineWrapper #1595
  2. monolithed commented on Apr 23, 2025

    @monolithed
    Author

    @hollandjake, thanks for the quick reply! Just wondering — how do other libraries typically handle this? Long tables are pretty common in PDFs

  3. hollandjake commented on Apr 23, 2025

    @hollandjake
    Contributor
    var dd = {
        pageSize: {width: 500, height: 200},
    	content: [
    		{
    			table: {
    			    columnStyles: [100],
    				body: [
    					[{text: 'LEFT_COLUMN', rowSpan: 3}, 'RIGHT_COLUM_ROW_1\n'.repeat(5)],
    					[null, 'RIGHT_COLUM_ROW_2\n'.repeat(5)],
    					[null, "RIGHT_COLUM_ROW_3"]
    				]
    			}
    		},
    	],
    }
    

    Image

    This is the outcome of pdfmake.

    @blikblum is this intended behaviour?

    @monolithed is this more of what you had in mind?

  4. monolithed commented on Apr 23, 2025

    @monolithed
    Author

    @hollandjake yeah, that's what I had in mind.

  5. blikblum commented on Apr 23, 2025

    @blikblum
    Member

    @blikblum is this intended behaviour?

    The pdfmake behavior seems reasonable

    I'd like to see also like other libraries does, like iText or QuestPDF.

    We should incorporate their experiences in designing and PDF api

  6. blikblum commented on Apr 23, 2025

    @blikblum
    Member

    2. This issue should be fixed by

    Can you add an test (unit or visual) that fails currently and passes with the PR?

  7. hollandjake commented on Apr 23, 2025

    @hollandjake
    Contributor
    1. This issue should be fixed by

    Can you add an test (unit or visual) that fails currently and passes with the PR?

    @blikblum Which PR do you want that in?

  8. blikblum commented on Apr 23, 2025

    @blikblum
    Member

    @blikblum Which PR do you want that in?

    The precision that is already open

  9. hollandjake commented on Apr 23, 2025

    @hollandjake
    Contributor

    @blikblum now added visual test

  10. monolithed commented on Apr 24, 2025

    @monolithed
    Author

    @blikblum, how long you think it'll take to fix?

  11. blikblum commented on Apr 24, 2025

    @blikblum
    Member

    Waiting for feedback of pdfmake dev

  12. hollandjake commented on Apr 24, 2025

    @hollandjake
    Contributor

    @blikblum for reference itext outputs the following

    Image

  13. monolithed commented on Apr 24, 2025

    @monolithed
    Author

    @hollandjake, probably it depends on the specified margins, but it looks standard-perfect

  14. hollandjake commented on Apr 24, 2025

    @hollandjake
    Contributor

    im just running QuestPDF for reference, will update when ive got that running

  15. hollandjake commented on Apr 24, 2025

    @hollandjake
    Contributor

    QuestPDF output:

    Image

  16. makyson commented on Apr 30, 2025

    @makyson

    any feedback on when this will be fixed ?

  17. hollandjake commented on Apr 30, 2025

    @hollandjake
    Contributor

    any feedback on when this will be fixed ?

    @makyson no target date yet. Having split columns over multiple pages is hard because content can be aligned vertically, which means it may have vertically centered text spanning multiple pages, any ideas would be greatly appreciated

  18. monolithed commented on Dec 4, 2025

    @monolithed
    Author

    Just checking any updates on this?

  19. hollandjake commented on Dec 4, 2025

    @hollandjake
    Contributor

    Apologies ive not been able to find any time to investigate and resolve the underlying issues (numeric precision) which are blocking the development of this. If anyone else if able to find the time please give it a try

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