{"action":"created","issue":{"url":"https://api.github.com/repos/MrRio/jsPDF/issues/1176","repository_url":"https://api.github.com/repos/MrRio/jsPDF","labels_url":"https://api.github.com/repos/MrRio/jsPDF/issues/1176/labels{/name}","comments_url":"https://api.github.com/repos/MrRio/jsPDF/issues/1176/comments","events_url":"https://api.github.com/repos/MrRio/jsPDF/issues/1176/events","html_url":"https://github.com/MrRio/jsPDF/issues/1176","id":221842691,"number":1176,"title":"New html2pdf package","user":{"login":"eKoopmans","id":8449639,"avatar_url":"https://avatars1.githubusercontent.com/u/8449639?v=3","gravatar_id":"","url":"https://api.github.com/users/eKoopmans","html_url":"https://github.com/eKoopmans","followers_url":"https://api.github.com/users/eKoopmans/followers","following_url":"https://api.github.com/users/eKoopmans/following{/other_user}","gists_url":"https://api.github.com/users/eKoopmans/gists{/gist_id}","starred_url":"https://api.github.com/users/eKoopmans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eKoopmans/subscriptions","organizations_url":"https://api.github.com/users/eKoopmans/orgs","repos_url":"https://api.github.com/users/eKoopmans/repos","events_url":"https://api.github.com/users/eKoopmans/events{/privacy}","received_events_url":"https://api.github.com/users/eKoopmans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-04-14T16:31:18Z","updated_at":"2017-04-14T16:39:51Z","closed_at":null,"body":"### Existing jsPDF plugins\r\n\r\nHi, I've been working on a new [html2pdf](https://github.com/eKoopmans/html2pdf) package that uses html2canvas + jsPDF to convert HTML content to PDF. I know there are already three existing jsPDF plugins for HTML: `addHTML`, `fromHTML`, and `html2pdf` (same name). I don't want to step on any toes - from what I can tell:\r\n\r\n* `fromHTML` is the oldest plugin and renders the HTML directly to PDF (which is great), but its support for complex HTML/CSS is lacking.\r\n* `addHTML` is newer (but now deprecated) and uses html2canvas/rasterizeHTML to create a canvas, then puts the image onto the PDF page. Current state is described at #944.\r\n* `html2pdf`: I haven't found much info (apart from the [demo](https://cdn.rawgit.com/MrRio/jsPDF/master/examples/html2pdf/showcase_supported_html.html)), but it looks like it renders directly to PDF like `fromHTML`, which again is great but runs the risk of poor HTML/CSS support.\r\n\r\n### New html2pdf package\r\n\r\nMy `html2pdf` package takes the same approach as `addHTML` - I convert to a canvas with html2canvas, split that image up into pages, and attach each image onto its own PDF page. I believe it has some advantages over the jsPDF plugins:\r\n\r\n* **Easier to use** - creating a PDF from an HTML element/page/string is one line: `html2pdf(element);`\r\n* **Fits content to the page** - it copies the HTML first into an (invisible) container div with the PDF page width, so that content can resize appropriately (also working on a 'shrink-to-page' option)\r\n* **Supports page-breaks** - a feature that comes up a lot, i.e. #190 \r\n* **Is external** - it keeps the logic separate and can respond more readily to updates in both repos (including html2canvas internally in jsPDF causes [some problems](https://github.com/MrRio/jsPDF/issues/270#issuecomment-246411476))\r\n* **Is external (disadvantage)** - it can't be used inline with other jsPDF commands the way the current plugins are - it's a standalone package that creates and closes the PDF.\r\n\r\n### Open issues\r\n\r\nThat said, I've found 48 open issues on jsPDF that I think `html2pdf` could resolve, but I don't want to start pushing `html2pdf` if it conflicts with jsPDF's internal implementations. @MrRio @Flamenco I'd appreciate your feedback!"},"comment":{"url":"https://api.github.com/repos/MrRio/jsPDF/issues/comments/294187542","html_url":"https://github.com/MrRio/jsPDF/issues/1176#issuecomment-294187542","issue_url":"https://api.github.com/repos/MrRio/jsPDF/issues/1176","id":294187542,"user":{"login":"Flamenco","id":819940,"avatar_url":"https://avatars1.githubusercontent.com/u/819940?v=3","gravatar_id":"","url":"https://api.github.com/users/Flamenco","html_url":"https://github.com/Flamenco","followers_url":"https://api.github.com/users/Flamenco/followers","following_url":"https://api.github.com/users/Flamenco/following{/other_user}","gists_url":"https://api.github.com/users/Flamenco/gists{/gist_id}","starred_url":"https://api.github.com/users/Flamenco/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Flamenco/subscriptions","organizations_url":"https://api.github.com/users/Flamenco/orgs","repos_url":"https://api.github.com/users/Flamenco/repos","events_url":"https://api.github.com/users/Flamenco/events{/privacy}","received_events_url":"https://api.github.com/users/Flamenco/received_events","type":"User","site_admin":false},"created_at":"2017-04-14T16:39:51Z","updated_at":"2017-04-14T16:39:51Z","body":"My first reaction would be to:\r\n\r\n1. List the end user's usage needs and issues.\r\n2. Write an API\r\n3. Let each _vendor_ implement the API\r\n4. Let the user choose the implementation they want.\r\n\r\nThis way each implementation will have a standardized usage and documentation.\r\n\r\nThe main issues I have seen are related to Pagination, Image Quality, CORS, Scaling, Tables, SVG integration, and Font handling.\r\n\r\n"}}
{"actor":{"display_login":"Flamenco"}}