{"action":"closed","issue":{"url":"https://api.github.com/repos/bpampuch/pdfmake/issues/1320","repository_url":"https://api.github.com/repos/bpampuch/pdfmake","labels_url":"https://api.github.com/repos/bpampuch/pdfmake/issues/1320/labels{/name}","comments_url":"https://api.github.com/repos/bpampuch/pdfmake/issues/1320/comments","events_url":"https://api.github.com/repos/bpampuch/pdfmake/issues/1320/events","html_url":"https://github.com/bpampuch/pdfmake/issues/1320","id":306463727,"number":1320,"title":"Error on clicking the download button twice?","user":{"login":"viveknaskar","id":23724869,"avatar_url":"https://avatars0.githubusercontent.com/u/23724869?v=4","gravatar_id":"","url":"https://api.github.com/users/viveknaskar","html_url":"https://github.com/viveknaskar","followers_url":"https://api.github.com/users/viveknaskar/followers","following_url":"https://api.github.com/users/viveknaskar/following{/other_user}","gists_url":"https://api.github.com/users/viveknaskar/gists{/gist_id}","starred_url":"https://api.github.com/users/viveknaskar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/viveknaskar/subscriptions","organizations_url":"https://api.github.com/users/viveknaskar/orgs","repos_url":"https://api.github.com/users/viveknaskar/repos","events_url":"https://api.github.com/users/viveknaskar/events{/privacy}","received_events_url":"https://api.github.com/users/viveknaskar/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-03-19T13:32:56Z","updated_at":"2018-03-26T06:38:26Z","closed_at":"2018-03-26T06:38:26Z","author_association":"NONE","body":"I have written code such that I am pushing the values one by one.\r\n\r\n`vm.pdfInfo.push({text: 'ABC', style: 'abc'});`\r\n `vm.pdfInfo.push({text: 'Test App', style: 'header'});`\r\n `vm.pdfInfo.push({text: documentType(), style: 'subheader'});`\r\n`createStudentInformation();`\r\n\r\nHere createStudentInformation() does take some dynamic values from the json based on some parameters and pushes like:\r\n\r\n`var createStudentInformation = function() {`\r\n                   ` var studentInformation = {};`                   \r\n                   ` $.each(vm.dynamicConfig.assignments.science.fields, function (index, field) {`\r\n                        `if (field.name === 'studentInformation'){`\r\n                           ` studentInformation = field.value;`\r\n                            `mappings = field.mappings;`\r\n                            `formatFunctions = field.formatFunctions;`\r\n                           ` blocks = field.blocks;`\r\n                       ` }`\r\n                    `});`\r\n                   ` if (studentInformation !== {}) {`\r\n                        `$.each(mappings, function (index, mapping) {`\r\n                           `var dispVal = '';`\r\n                          ` var formatFunction = formatFunctions[index];`\r\n                           `if (formatFunction !== '') {`\r\n                             `  dispVal = $scope[formatFunction](dispVal);`\r\n                           `}`\r\n                          ` if (mapping !== '') {`\r\n                              `studentInformation.table.body[index+1].push(dispVal);`\r\n                           `}`\r\n                       ` });`\r\n                        `vm.pdfInfo.push(studentInformation);`\r\n                    `}`\r\n               ` };`\r\n\r\nI have a requirement such that I have to use methods like above and push into the document. The values for the table is coming from the json. I am able to download the pdf for the first time, but when I am clicking the download button again, I am getting an error like below -\r\n\r\npdfmake.js:1743 Uncaught TypeError: Cannot read property '_calcWidth' of undefined\r\n    at pdfmake.js:1743\r\n    at n.auto (pdfmake.js:1743)\r\n    at i.processRow (pdfmake.js:1743)\r\n    at i.processTable (pdfmake.js:1743)\r\n    at pdfmake.js:1743\r\n    at pdfmake.js:1743\r\n    at i.processNode (pdfmake.js:1743)\r\n    at pdfmake.js:1743\r\n    at Array.forEach (<anonymous>)\r\n    at i.processVerticalContainer (pdfmake.js:1743)\r\n\r\n\r\n"}}
{"actor":{"display_login":"viveknaskar"}}