{"action":"created","issue":{"url":"https://api.github.com/repos/someatoms/jsPDF-AutoTable/issues/12","labels_url":"https://api.github.com/repos/someatoms/jsPDF-AutoTable/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/someatoms/jsPDF-AutoTable/issues/12/comments","events_url":"https://api.github.com/repos/someatoms/jsPDF-AutoTable/issues/12/events","html_url":"https://github.com/someatoms/jsPDF-AutoTable/issues/12","id":66335829,"number":12,"title":"Issue with Header Rendering","user":{"login":"mpaul31","id":206767,"avatar_url":"https://avatars.githubusercontent.com/u/206767?v=3","gravatar_id":"","url":"https://api.github.com/users/mpaul31","html_url":"https://github.com/mpaul31","followers_url":"https://api.github.com/users/mpaul31/followers","following_url":"https://api.github.com/users/mpaul31/following{/other_user}","gists_url":"https://api.github.com/users/mpaul31/gists{/gist_id}","starred_url":"https://api.github.com/users/mpaul31/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpaul31/subscriptions","organizations_url":"https://api.github.com/users/mpaul31/orgs","repos_url":"https://api.github.com/users/mpaul31/repos","events_url":"https://api.github.com/users/mpaul31/events{/privacy}","received_events_url":"https://api.github.com/users/mpaul31/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-04T15:59:40Z","updated_at":"2015-04-04T16:13:25Z","closed_at":null,"body":"hey buddy\r\n\r\nevery couple prints my output has a bug gap between the header and the table. do you see anything goofy going on in my code? like i said it works most of the time\r\n\r\nvar doc = new jsPDF('p', 'pt');\r\n        var cols = [\r\n            { title: \"Food\", key: \"food\" },\r\n            { title: \"Amount\", key: \"amount\" },\r\n            { title: \"Serving Size\", key: \"servingSize\" },\r\n            { title: \"Protein\", key: \"protein\" },\r\n            { title: \"Carbs\", key: \"carbs\" },\r\n            { title: \"Fat\", key: \"fat\" },\r\n            { title: \"Calories\", key: \"calories\" }\r\n        ];\r\n\r\n        doc.setFontSize(22);\r\n        doc.text(day.name, 40, 40);\r\n        doc.setFontSize(12);\r\n\r\n        angular.forEach(day.sets, function (set) {\r\n            angular.forEach(set.meals, function (meal) {\r\n                var rows = [];\r\n                angular.forEach(meal.items, function (item) {\r\n                    var uom = _.find($scope.uomCache, function (uom) {\r\n                        return uom.id === item.measurementId;\r\n                    });\r\n                    rows.push({\r\n                        \"food\": item.food.name,\r\n                        \"amount\": item.amount,\r\n                        \"servingSize\": uom.name,\r\n                        \"protein\": $filter('number')($scope.stats.forItem(item).protein.amount, 2),\r\n                        \"carbs\": $filter('number')($scope.stats.forItem(item).carbohydrate.amount, 2),\r\n                        \"fat\": $filter('number')($scope.stats.forItem(item).fat.amount, 2),\r\n                        \"calories\": $filter('number')($scope.stats.forItem(item).totalCalories, 2),\r\n                    });\r\n                });\r\n                rows.push({\r\n                    \"food\": \"Totals\",\r\n                    \"amount\": \"\",\r\n                    \"servingSize\": \"\",\r\n                    \"protein\": $filter('number')($scope.stats.forMeal(meal).protein.amount, 2),\r\n                    \"carbs\": $filter('number')($scope.stats.forMeal(meal).carbohydrate.amount, 2),\r\n                    \"fat\": $filter('number')($scope.stats.forMeal(meal).fat.amount, 2),\r\n                    \"calories\": $filter('number')($scope.stats.forMeal(meal).totalCalories, 2),\r\n                });\r\n\r\n                if (angular.equals(meal, _.last(set.meals))) {\r\n                    rows.push({\r\n                        \"food\": \"Grand Totals\",\r\n                        \"amount\": \"\",\r\n                        \"servingSize\": \"\",\r\n                        \"protein\": $filter('number')($scope.stats.forMealPlan().protein.amount, 2),\r\n                        \"carbs\": $filter('number')($scope.stats.forMealPlan().carbohydrate.amount, 2),\r\n                        \"fat\": $filter('number')($scope.stats.forMealPlan().fat.amount, 2),\r\n                        \"calories\": $filter('number')($scope.stats.forMealPlan().totalCalories, 2),\r\n                    });\r\n                };\r\n\r\n                var header = function (doc, pageCount, options) {\r\n                    doc.setFontSize(12);\r\n                    doc.text($scope.getSetOrdinalPdf(set, meal), 40, doc.autoTableEndPos().y - 5);\r\n                    doc.setFontSize(options.fontSize);\r\n                };\r\n\r\n                var endPos = doc.autoTableEndPos();\r\n                doc.autoTable(cols, rows, {\r\n                    renderHeader: header,\r\n                    startY: endPos ? endPos.y + 25 : 75,    //firstStartY\r\n                    avoidPageSplit: true,\r\n                    margins: { horizontal: 40, top: 40, bottom: 40 }\r\n                });\r\n            });\r\n        });\r\n\r\n        doc.save($scope.mealplan.name + ' (' + day.name + ').pdf');"},"comment":{"url":"https://api.github.com/repos/someatoms/jsPDF-AutoTable/issues/comments/89608090","html_url":"https://github.com/someatoms/jsPDF-AutoTable/issues/12#issuecomment-89608090","issue_url":"https://api.github.com/repos/someatoms/jsPDF-AutoTable/issues/12","id":89608090,"user":{"login":"someatoms","id":3586691,"avatar_url":"https://avatars.githubusercontent.com/u/3586691?v=3","gravatar_id":"","url":"https://api.github.com/users/someatoms","html_url":"https://github.com/someatoms","followers_url":"https://api.github.com/users/someatoms/followers","following_url":"https://api.github.com/users/someatoms/following{/other_user}","gists_url":"https://api.github.com/users/someatoms/gists{/gist_id}","starred_url":"https://api.github.com/users/someatoms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/someatoms/subscriptions","organizations_url":"https://api.github.com/users/someatoms/orgs","repos_url":"https://api.github.com/users/someatoms/repos","events_url":"https://api.github.com/users/someatoms/events{/privacy}","received_events_url":"https://api.github.com/users/someatoms/received_events","type":"User","site_admin":false},"created_at":"2015-04-04T16:13:24Z","updated_at":"2015-04-04T16:13:24Z","body":"I can't see anything wrong by a quick look and it would take a lot of time for me to make your example runnable. Can you post a smaller runnable example which reproduces the issue? Preferably one without angular dependency and with example data. "}}