{"action":"closed","issue":{"url":"https://api.github.com/repos/MrRio/jsPDF/issues/2184","repository_url":"https://api.github.com/repos/MrRio/jsPDF","labels_url":"https://api.github.com/repos/MrRio/jsPDF/issues/2184/labels{/name}","comments_url":"https://api.github.com/repos/MrRio/jsPDF/issues/2184/comments","events_url":"https://api.github.com/repos/MrRio/jsPDF/issues/2184/events","html_url":"https://github.com/MrRio/jsPDF/issues/2184","id":393809063,"node_id":"MDU6SXNzdWUzOTM4MDkwNjM=","number":2184,"title":"React js: addImage is not a function","user":{"login":"longtd269","id":13362981,"node_id":"MDQ6VXNlcjEzMzYyOTgx","avatar_url":"https://avatars0.githubusercontent.com/u/13362981?v=4","gravatar_id":"","url":"https://api.github.com/users/longtd269","html_url":"https://github.com/longtd269","followers_url":"https://api.github.com/users/longtd269/followers","following_url":"https://api.github.com/users/longtd269/following{/other_user}","gists_url":"https://api.github.com/users/longtd269/gists{/gist_id}","starred_url":"https://api.github.com/users/longtd269/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/longtd269/subscriptions","organizations_url":"https://api.github.com/users/longtd269/orgs","repos_url":"https://api.github.com/users/longtd269/repos","events_url":"https://api.github.com/users/longtd269/events{/privacy}","received_events_url":"https://api.github.com/users/longtd269/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-12-24T04:40:03Z","updated_at":"2018-12-24T22:35:08Z","closed_at":"2018-12-24T22:35:08Z","author_association":"NONE","body":"I'm using jsPDF for react project.\r\nI have error: addImage is not a function\r\njsPDF version: \r\n    \"jspdf\": \"^1.4.1\"\r\n\r\nThis is mycode:\r\nimport * as jsPDF from 'jspdf'\r\n```\r\nhtml2canvas(input, {useCORS: true})\r\n      .then((canvas) => {\r\n        const imgData = canvas.toDataURL('image/png');\r\n        let imgWidth = 210;\r\n        let pageHeight = 297;\r\n        let imgHeight = canvas.height * imgWidth / canvas.width;\r\n        let heightLeft = imgHeight;\r\n        let doc = new jsPDF('p', 'mm', 'a4');\r\n        let position = 0;\r\n        doc.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight);\r\n        heightLeft -= pageHeight;\r\n        while (heightLeft >= 0) {\r\n          position = heightLeft - imgHeight;\r\n          doc.addPage();\r\n          doc.addImage(imgData, 'PNG', 0, position, imgWidth, imgHeight);\r\n          heightLeft -= pageHeight;\r\n        }\r\n        doc.save(\"test.pdf\");\r\n      })  ;\r\n```\r\n\r\n Did i do something wrong?\r\n\r\n"}}
{"actor":{"display_login":"arasabbasi"}}