Replies: 12 comments 14 replies
-
Thanks for bringing up the topic :) |
Beta Was this translation helpful? Give feedback.
-
I deleted my previously comment in order to follow the rules properly. Dinamic tables are a good deal, not easy to do and a lot of specified rules. Like break with content, break page with content and even ignore filling the table to not break the layoult. It's very complex to stabilish rules about it and some bugs happens. This example is from a contract and some services. We have common services paid monthly and paid per hour. So in this example i have 2 dinamic tables and the must respect each other.
We have some break lines cz of the names too long and besides the max of lines per table was not reached, it breaks the page when another big name comes so it doesn't break the layout. Same pdf but i removed 2 hour services and the tables still are working and respecting each other Now all hour modules were removed, the layout got broken by a bug, means it works the most of the times but sometimes it happens bugs we can't prevent. I am not the author of 100% of the code, its a legacy project that I implemented some dinamic features. I didn't have too much time to do that and I assume it's not perfect.
This one i am the author of 100% of the code and i am using puppeteer. Besides being a simple table it works fine One line added over the limit More lines added much more lines added
something like this would be good, not considered a non-intuitive thing for a developer using your lib: const template: Template = {
basePdf: BLANK_PDF,
schemas: [
{
table: {
type: 'table',
position: { x: 0, y: 0 },
width: 100,
height: 220,
...props,
header: [
{ x: { width: 30, height: 10, ...props } },
{ y: { width: 30, height: 10, ...props } },
{ z: { width: 40, height: 10, ...props } },
],
body: {
height: 20,
max-columns: 10,
...props
},
footer: {
height: 10,
...props
}
},
},
],
}; In fact, rules about breaking page or ignoring to fill the table and jump to next page should be responsability of the developer using it.
|
Beta Was this translation helpful? Give feedback.
-
@Mauro-Domingues I think your approach to using Puppeteer to create tables is correct. There is an appropriate way to use this library, and in the case of using tables, I would recommend using a different library, specifically Puppeteer. |
Beta Was this translation helpful? Give feedback.
-
It would be a great idea to develop the possibility to include tables. For a start, an implementation like in pdfmake. See tables on http://pdfmake.org/playground.html |
Beta Was this translation helpful? Give feedback.
-
I don't currently need to display a table, but I do need to display a dynamic text block that can be short or long. Theoretically all you need is a calculated height of the text, if you could make that available in the schema that would be helpful. Maybe something like this: const template: Template = {
basePdf: BLANK_PDF,
schemas: [
{
a: {
type: 'text',
position: { x: 0, y: 0 },
width: 10,
height: 'auto',
},
b: {
type: 'text',
position: (schemas) => ({
x: schemas[0].a.position.x,
y: schemas[0].a.position.y + schemas[0].a.height + 10,
}),
width: 10,
height: 'auto',
},
c: {
type: 'text',
position: (schemas) => ({
x: schemas[0].b.position.x,
y: schemas[0].b.position.y + schemas[0].b.height + 10,
}),
width: 10,
height: 'auto',
},
},
{
d: {
type: 'text',
position: (schemas) => ({
x: schemas[0].c.position.x,
// page is where the item is actually rendered as index, so 1 mean it overflows from the first page
y: (schemas[0].c.page === 1 ? schemas[0].c.position.y + schemas[0].c.height + 10 : 10),
}),
width: 10,
height: 'auto',
},
},
],
}; This principle could also be applied to table rows. But I'm not really sure though, this could be very confusing with a lot of pages, or just downright impossible to implement. Also this would be quite hard to do graphically. |
Beta Was this translation helpful? Give feedback.
-
Another thing that could be considered is constraint/anchor system. This would be quite similar to ConstraintLayout on android. It would be possible to configure graphically. Although this could be over-engineered solution for this problem |
Beta Was this translation helpful? Give feedback.
-
I do not want to address this feature within the core part of pdfme. The demand for this feature still exists. Ongoing discussions are open to anyone, including myself, to participate. |
Beta Was this translation helpful? Give feedback.
-
Version 3 has been feature released. It might be possible to implement by defining the new custom schemas feature. Is there anyone who wants to try implementing this? |
Beta Was this translation helpful? Give feedback.
-
Just discovered pdfMe today. Looks very cool! But I'm needing to be able to support variable length content, including multiple pages. For instance on an invoice or other business document; it might have 8 lines per page, but might need to be 12 lines (2 pages). I can do this with puppeteer-html-pdf and using their handlebars html template, passing in the JSON data in an array, and it dynamically will adjust the length. Here's how they handle the "loop" in the template:
But I was really looking for the ability to be able to edit and format the template with a nice editor, which your setup has. |
Beta Was this translation helpful? Give feedback.
-
I have decided to implement this feature in V4. Issue: Add DynamicTable Schema #332 |
Beta Was this translation helpful? Give feedback.
-
The DynamicTable Schema has been released as Beta in pdfme V4. For more details, please refer to the following documentation: |
Beta Was this translation helpful? Give feedback.
-
🐰UPDATE🐰
I have decided to implement this feature in V4.
There are still many blockers, but I have been able to judge that it can probably be realized.
Issue: Add DynamicTable Schema #332
Old Message:
Hello everyone,
I am hand-dot, the author of the pdfme.
Unfortunately, at the moment, pdfme does not have table functionality.
I have received requests for features like these in the past:
Furthermore, when I was looking at the search history on the pdfme website, I noticed that the most frequent searches were related to tables.
I am considering implementing table functionality to meet this demand.
However, I anticipate that this feature could become complex to use.
For example, I cannot decide on my own what specifications should be for the generate function interface, Designer UI, Form UI, and page-brake behavior.
That's why I have decided to post this and would like to discuss the matter with all of you.
I believe that if the specifications become clear, I can implement this feature.
In this discussion, we should avoid personal opinions and ideas that have not yet considered implementation methods.
I would like to have a constructive discussion based on concrete examples from other tools and libraries.
Thank you in advance.
Beta Was this translation helpful? Give feedback.
All reactions