Git Product home page Git Product logo

Comments (7)

miteshgcs avatar miteshgcs commented on September 24, 2024 2

how can i rotate a big table in jspdf auto table plugin??

from jspdf-autotable.

mpaul31 avatar mpaul31 commented on September 24, 2024

my margins are also not being applied so maybe something is up in general. here is the whole code

        var cols = [
            { title: "Food", key: "food" },
            { title: "Amount", key: "amount" },
            { title: "Serving Size", key: "servingSize" },
            { title: "Protein", key: "protein" },
            { title: "Carbs", key: "carbs" },
            { title: "Fat", key: "fat" },
            { title: "Calories", key: "calories" }
        ];
doc.setFontSize(20);
doc.text($scope.selectedDay.name, 40, 48);

angular.forEach($scope.selectedDay.sets, function (set) {
    angular.forEach(set.meals, function (meal) {
        var rows = [];
        angular.forEach(meal.items, function (item) {
            rows.push({
                "food": item.food.name,
                "amount": item.amount,
                "servingSize": "cup",
                "protein": "0",
                "carbs": "0",
                "fat": "0",
                "calories": "0"
            });
        });
        doc.autoTable(cols, rows, { margins: { horizontal: 40, top: 60, bottom: 40 }});
    });
});

doc.save('table.pdf');

from jspdf-autotable.

simonbengtsson avatar simonbengtsson commented on September 24, 2024

Everything seems to be in order, however since you don't specify the startY position, they all get printed on the same place.

Checkout the multiple tables example in examples/examples.js for an example how to use the startY option.

from jspdf-autotable.

mpaul31 avatar mpaul31 commented on September 24, 2024

thanks bud will do!

from jspdf-autotable.

mpaul31 avatar mpaul31 commented on September 24, 2024

also a cool feature would to have an autoTableCollection method that took in an array and made sure if the entire table did not fit on the page it would go to the next. damn end users.. :)

from jspdf-autotable.

simonbengtsson avatar simonbengtsson commented on September 24, 2024

Sounded like a good idea! I added an avoidPageSplit option now (version 1.1) which draws the table on a fresh page instead of splitting it up into multiple pages if its height is too long. You can see how it works in the same "Multiple tables" example. I don't think a autoTableCollection method would be a good idea though. That would require the plugin to keep track of the height of custom headers etc which would complicate the api.

UPDATE In version 2.0 avoidPageSplit has become pageBreak: 'avoid';

from jspdf-autotable.

mpaul31 avatar mpaul31 commented on September 24, 2024

awesome man will try it out! thanks again the plugin is really saving my butt!

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.