payload: {"action":"created","issue":{"url":"https://api.github.com/repos/chunyenHuang/hummusRecipe/issues/126","repository_url":"https://api.github.com/repos/chunyenHuang/hummusRecipe","labels_url":"https://api.github.com/repos/chunyenHuang/hummusRecipe/issues/126/labels{/name}","comments_url":"https://api.github.com/repos/chunyenHuang/hummusRecipe/issues/126/comments","events_url":"https://api.github.com/repos/chunyenHuang/hummusRecipe/issues/126/events","html_url":"https://github.com/chunyenHuang/hummusRecipe/issues/126","id":466512216,"node_id":"MDU6SXNzdWU0NjY1MTIyMTY=","number":126,"title":"Is it possible to append a PDF from memory?","user":{"login":"joshfoskett","id":1159106,"node_id":"MDQ6VXNlcjExNTkxMDY=","avatar_url":"https://avatars1.githubusercontent.com/u/1159106?v=4","gravatar_id":"","url":"https://api.github.com/users/joshfoskett","html_url":"https://github.com/joshfoskett","followers_url":"https://api.github.com/users/joshfoskett/followers","following_url":"https://api.github.com/users/joshfoskett/following{/other_user}","gists_url":"https://api.github.com/users/joshfoskett/gists{/gist_id}","starred_url":"https://api.github.com/users/joshfoskett/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshfoskett/subscriptions","organizations_url":"https://api.github.com/users/joshfoskett/orgs","repos_url":"https://api.github.com/users/joshfoskett/repos","events_url":"https://api.github.com/users/joshfoskett/events{/privacy}","received_events_url":"https://api.github.com/users/joshfoskett/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-07-10T20:47:20Z","updated_at":"2019-07-11T22:49:19Z","closed_at":null,"author_association":"NONE","body":"Similar question to #68.\r\n\r\nEssentially, all of our files are hosted on S3, so ideally I'd like to just fetch the body of each PDF, which is represented as a `Buffer`, and use that instead of storing it on the server, providing a path, and then deleting it afterwards. It works fine when instantiating `new HummasRecipe(pdfBuffer)`. However, `recipe.appendPage(pdfBuffer)` results in:\r\n```\r\nTypeError: Unable to start parsing PDF file\r\n    at Recipe.appendPage (/.../node_modules/hummus-recipe/lib/appendPage.js:16:30)\r\n    at additionalPages.forEach (/.../start/routes.js:45:14)\r\n    at process._tickCallback (internal/process/next_tick.js:68:7)\r\n```\r\n\r\nLooking through the source code, I noticed that [Recipe.js](https://github.com/chunyenHuang/hummusRecipe/blob/master/lib/Recipe.js#L129) wrapped the `Buffer` with `hummus.PDFRStreamForBuffer`, and passed it to `hummus.createReader`, which [`appendPage.js`](https://github.com/chunyenHuang/hummusRecipe/blob/master/lib/appendPage.js#L16) also does. However, I then get:\r\n```\r\nTypeError: unable to create copying context. verify that the target is an existing PDF file\r\n    at Object.appendPDFPagesFromPDFWithAnnotations (/.../node_modules/hummus-recipe/lib/utils.js:41:30)\r\n    at Recipe.appendPage (/.../node_modules/hummus-recipe/lib/appendPage.js:42:21)\r\n    at additionalPages.forEach (/.../start/routes.js:45:14)\r\n    at process._tickCallback (internal/process/next_tick.js:68:7)\r\n```\r\n\r\nIf I store the file locally, and reference its path, it works as expected."},"comment":{"url":"https://api.github.com/repos/chunyenHuang/hummusRecipe/issues/comments/510681763","html_url":"https://github.com/chunyenHuang/hummusRecipe/issues/126#issuecomment-510681763","issue_url":"https://api.github.com/repos/chunyenHuang/hummusRecipe/issues/126","id":510681763,"node_id":"MDEyOklzc3VlQ29tbWVudDUxMDY4MTc2Mw==","user":{"login":"thebenlamm","id":5175102,"node_id":"MDQ6VXNlcjUxNzUxMDI=","avatar_url":"https://avatars2.githubusercontent.com/u/5175102?v=4","gravatar_id":"","url":"https://api.github.com/users/thebenlamm","html_url":"https://github.com/thebenlamm","followers_url":"https://api.github.com/users/thebenlamm/followers","following_url":"https://api.github.com/users/thebenlamm/following{/other_user}","gists_url":"https://api.github.com/users/thebenlamm/gists{/gist_id}","starred_url":"https://api.github.com/users/thebenlamm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thebenlamm/subscriptions","organizations_url":"https://api.github.com/users/thebenlamm/orgs","repos_url":"https://api.github.com/users/thebenlamm/repos","events_url":"https://api.github.com/users/thebenlamm/events{/privacy}","received_events_url":"https://api.github.com/users/thebenlamm/received_events","type":"User","site_admin":false},"created_at":"2019-07-11T22:49:19Z","updated_at":"2019-07-11T22:49:19Z","author_association":"CONTRIBUTOR","body":"I ran into this issue today and this is what I've got to contribute.\r\n\r\nFirst off I commented out lines 16 through 36 in `appendPage.js`. I only have one page in my pdf so didn't want to bother with createReader which is only used to get the page count.\r\n\r\nSo now it's throwing on `appendPage.js` line 42 on `hummusUtils.appendPDFPagesFromPDFWithAnnotations()`.\r\n\r\n`utils.appendPDFPagesFromPDFWithAnnotations()` calls `pdfWriter.createPDFCopyingContext()`.\r\n(Incidentally, according do HummusJS [tests](https://github.com/galkahana/HummusJS/blob/b699d6a01ba027428120cbe5b1c16813bed0521d/tests/StreamCopyingContext.js) this exact scenario should work.)\r\n\r\n[`createPDFCopyingContext()`](https://github.com/galkahana/HummusJS/blob/457f273a5886342ecd6613e12bc3baf5d8e25ce6/src/PDFWriterDriver.cpp#L1068) is c++ code and is where the error\r\n\r\n     unable to create copying context. verify that the target is an existing PDF file\r\nis thrown from, apparently because the `copyingContext` is not set. I'm not so familiar with c++ but it seems the issue is on [line 1111](https://github.com/galkahana/HummusJS/blob/457f273a5886342ecd6613e12bc3baf5d8e25ce6/src/PDFWriterDriver.cpp#L1111) where my best guess is the proxy isn't being set correctly.\r\n\r\n\r\n"}}
other: {"actor":{"display_login":"thebenlamm"}}