-
Notifications
You must be signed in to change notification settings - Fork 251
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
New feature: FPDF.table() #701
Comments
The PR is almost ready: #703 |
Hey! I'm Martin, the maintainer of pypdf and PyPDF2 👋 Do you think the table-feature could be added in a way that it's possible to read the table structure from the PDF (programmatically, without heuristics)? |
I was thinking about "14.6 Marked Content", see https://accessible-pdf.info/basics/general/overview-of-the-pdf-tags |
Thank you for reaching out @MartinThoma! Yes, this is a really good suggestion. However, I am not sure how best to test that we implement this right... |
Good question! I want to give those capabilities to Looking at some libraries:
I've actually asked this several years ago and haven't received an answer: How can I extract all PDF Tags related to content with Python? |
Thank you for the detailed answer @MartinThoma! I have just added a commit to PR #703 related to this:
I was not able to find examples of using Given that, among tools dedicated to PDF-tables extraction, none of them uses PDF tags / annotations in the process of doing their job, I am not sure that adding PDF tags is really worthwile... What do you think about this @MartinThoma? |
Wow, you're amazing 😍
Oops, my bad, I mistyped 🙈
Yes, I understand. It's a bit of a henn-egg-problem. Please don't forget that screen readers / accessibility solutions might use the tags as well. I think the tags were originally designed for them. But here I have no knowledge.
I agree 👍 |
Current situation
fpdf2
currently let users employ thecell()
&multi_cell()
methods to build tables, as demonstrated in part 5 of our tutorial: https://pyfpdf.github.io/fpdf2/Tutorial.html#tuto-5-creating-tablesWe also have some recipes regarding building tables in our documentation: https://pyfpdf.github.io/fpdf2/Tables.html
Based on the feedbacks in several table-related issues & discussions opened on this GitHub project, it seems to me that a
FPDF.table()
method would be very handy for our users.Features
It would be ideal that the end implementation provides the following set of features:
colspan
)fpdf/html.py
by a call to this newFPDF.table()
methodMethod design
In issue #680 I pitched the following API for this feature:
Regarding this, feedbacks and alternative suggestions are very welcome! 😊
Here is what I like about this one:
table()
context, which mean that we'll be able to perform some calculations on the row heights / column widths based on all the table content provideddata
object provided in one go to atable()
method, while still making it easy to build a table based on such bigdata
dictionary / sequencetable()
. The image() method for example, with its 11 parameters, is becoming a bit difficult to apprehend.The text was updated successfully, but these errors were encountered: