Git Product home page Git Product logo

Comments (11)

mmghv avatar mmghv commented on July 26, 2024 1

I would get pageNumber of both tables, table1:2 > table2:1 then I would get finalY of table1 (120) (because it spans more pages) and draw table3 giving startY using this.

Edit: don't forget to set the current doc page when drawing table3 to be the starting page + pageNumber of the longest table.

from jspdf-autotable.

mmghv avatar mmghv commented on July 26, 2024

Check out this example with a similar layout of what you want :

https://simonbengtsson.github.io/jsPDF-AutoTable/#multiple

code : https://github.com/simonbengtsson/jsPDF-AutoTable/blob/master/examples/examples.js#L135

from jspdf-autotable.

thediveshsharma avatar thediveshsharma commented on July 26, 2024

Check out this example with a similar layout of what you want :

https://simonbengtsson.github.io/jsPDF-AutoTable/#multiple

code : https://github.com/simonbengtsson/jsPDF-AutoTable/blob/master/examples/examples.js#L135

We've got six units, and for each unit, we're generating tables for both deposits and withdrawals. The thing is, these tables can vary in length. Sometimes, one might be longer than the other.

To keep things neat, I'm trying to align these tables properly. My plan is to figure out which table (deposits or withdrawals) is longer, and then start the next table from where the longest one ends.

But here's the snag: when one of the tables stretches onto a new page, the coordinates go wonky. This messes up my calculations, especially when I'm trying to find the length of the longest table.

So, I'm looking for a way to handle this gracefully. I need to adjust the table positions dynamically, considering page breaks and making sure everything stays in place, regardless of how long the tables get.

Any ideas on how we can tackle this?

from jspdf-autotable.

mmghv avatar mmghv commented on July 26, 2024

I didn't review your code, but you would need to utilize pageNumber & finalY properties of the drawn tables to determine the longest one and draw the next table with startY accordingly.

from jspdf-autotable.

thediveshsharma avatar thediveshsharma commented on July 26, 2024

I didn't review your code, but you would need to utilize pageNumber & finalY properties of the drawn tables to determine the longest one and draw the next table with startY accordingly.

thanks but I am struck on this since many days.
I think this package owners dont reply to queries anymore.
I will try some other package.

from jspdf-autotable.

mmghv avatar mmghv commented on July 26, 2024

I'm a collaborator in this project, you haven't shown an actual bug in the package, rather, you're unable to achieve a certain layout which is a question better suited for StackOverflow. our time is limited and we spend it trying to improve the package.

Closing this for now, please feel free to reopen if you discover an actual bug and are able to reproduce it in a codepen.

from jspdf-autotable.

thediveshsharma avatar thediveshsharma commented on July 26, 2024

from jspdf-autotable.

mmghv avatar mmghv commented on July 26, 2024

I don't see any bugs there, you have pageNumber, finalY and startY which gives you the ability to figure out the pages spanned by the table, and the last Y position of the table on the last page, using this you could easily set the next table startY, if any of these don't work as expected or give a wrong value please feel free to report a specific bug, I might add an example demonstrating this when I have the time.

from jspdf-autotable.

thediveshsharma avatar thediveshsharma commented on July 26, 2024

from jspdf-autotable.

thediveshsharma avatar thediveshsharma commented on July 26, 2024

I would get pageNumber of both tables, table1:2 > table2:1 then I would get finalY of table1 (120) (because it spans more pages) and draw table3 giving startY using this.

Edit: don't forget to set the current doc page when drawing table3 to be the starting page + pageNumber of the longest table.

I used this and was able to achieve the desired layout.
Thanks alot.. I was struck on this for 2 weeks.
Finally decided to make a post and it helped me. <3
bankReportAxisBank2024-04-16.pdf
I have attached a desired output file.
Can I contribute and add an example of multitable with loop spanning multiple pages example?
Or you can add it so others can benefit too?

from jspdf-autotable.

mmghv avatar mmghv commented on July 26, 2024

I'm glad to hear that.
We are currently working on v4 which includes breaking changes so no use of adding new examples at the moment, it could be added after v4 is released.

from jspdf-autotable.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.