Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create table layout #2343

Closed
mocanew opened this issue Jun 20, 2023 · 6 comments
Closed

Create table layout #2343

mocanew opened this issue Jun 20, 2023 · 6 comments

Comments

@mocanew
Copy link

mocanew commented Jun 20, 2023

Is your feature request related to a problem? Please describe.
I'm the author of @ag-media/react-pdf-table, and after much time wrestling with the layout system, I've concluded that there's no way to implement a proper table layout with the current primitives.

Describe the solution you'd like
The solution is not fully thought through, but I think the most essential parts are:

  • border size/style/color inheritance needs to be fixed (it doesn't seem to be working at all currently)
  • implement collapsible borders
  • add a prop to the View component instructing it to move the whole component and all its children onto the next page if it doesn't fit on the current one

One alternative might be to add table primitives and have them be special cases in the layout package.

Describe alternatives you've considered
As of now, @ag-media/react-pdf-table is usable for a table that is contained to one page (we use it in production already), but if you want to wrap a table to multiple pages, it gets weird with no way of fixing it.

@mocanew mocanew changed the title Create table component Create table layout Jun 20, 2023
@Betree
Copy link

Betree commented Feb 20, 2024

Since react-pdf is based on PDFKit, could @ag-media/react-pdf-table somehow access the PDFKit instance directly and create the shapes using the primitive functions it's exposing? https://github.com/natancabral/pdfkit-table could then provide some inspiration.

We (@opencollective) would love to migrate to react-pdf, but we need good support for multi-page tables. We would happily use https://github.com/ag-media/react-pdf-table for that, but I agree that native support for tables in this library would be fantastic.

@mocanew
Copy link
Author

mocanew commented Feb 27, 2024

@Betree, thanks for the linked repo; it might be the solution we're searching for if we can somehow reconcile react-pdf's layout with the table implementation. I'll take a more in-depth look in a couple of days.

@bogdan-futurelog
Copy link

@mocanew Hello! Are there any updates regarding native table support in react-pdf library?

NathanVss added a commit to suitenumerique/docs that referenced this issue Feb 14, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
NathanVss added a commit to suitenumerique/docs that referenced this issue Feb 14, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
NathanVss added a commit to suitenumerique/docs that referenced this issue Feb 14, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
NathanVss added a commit to suitenumerique/docs that referenced this issue Feb 14, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
NathanVss added a commit to suitenumerique/docs that referenced this issue Feb 19, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
NathanVss added a commit to suitenumerique/docs that referenced this issue Feb 19, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
NathanVss added a commit to suitenumerique/docs that referenced this issue Feb 19, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
bzg pushed a commit to bzg/docs that referenced this issue Feb 27, 2025
The previous way of rendering table was causing issues when tables
could not fit on one page. I then came accross this discussion
diegomura/react-pdf#2343. The author
created a lib to improve the rendering of table, it's better, but
still not perfect maybe.
@diegomura
Copy link
Owner

This lib won't support tables out of the box as we just provide with the primitives. Other libs can and do render tables

@YousefED
Copy link

YousefED commented Mar 4, 2025

Hi @diegomura ! When you say "other libs can and do render tables", do you have any thoughts / ideas on how we can integrate other libs to accomplish things like this? (and how to integrate such a 3rd party libary)? Just some pointers to what you have in mind would be very helpful

@push32
Copy link

push32 commented Mar 7, 2025

hi @diegomura, i'm using react-pdf v4 and while import the repo throws error "Invalid border width: undefined"

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

No branches or pull requests

6 participants