TypeError: Unable to end PDF
See original GitHub issueHere is my code
const pdfDoc = new HummusRecipe('output.pdf', 'output2.pdf')
pdfDoc
// edit 1st page
.editPage(1)
.text('Add some texts to an existing pdf file', 50, 50)
// end and save
.endPDF();
Here is the error log
TypeError: Unable to end PDF
at Recipe.endPDF (/Users/chris/development/theVelops/solstar-api/node_modules/hummus-recipe/lib/Recipe.js:173:21)
at addContractIdInPdf (/Users/chris/development/theVelops/solstar-api/functions/insertContractIdInPdf.js:19:6)
at Object.<anonymous> (/Users/chris/development/theVelops/solstar-api/functions/insertContractIdInPdf.js:24:1)
at Module._compile (module.js:635:30)
at loader (/Users/chris/.nvm/versions/node/v8.9.2/lib/node_modules/babel-cli/node_modules/babel-register/lib/node.js:144:5)
at Object.require.extensions.(anonymous function) [as .js] (/Users/chris/.nvm/versions/node/v8.9.2/lib/node_modules/babel-cli/node_modules/babel-register/lib/node.js:154:7)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Function.Module.runMain (module.js:676:10)
What am I doing wrong?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
[hummus pageModifier]: Unable to end PDF (Randomly)
The issue was, hummus is processing before fileStream for png image get closed. So, I need to take care of fstream close event...
Read more >HummusJS - Bountysource
TypeError : Unable to start parsing PDF file at Object.<anonymous> (/Users/blairjanis/workspace/node/hummus-test/index.js:10:24) at Module.
Read more >hummus pageModifier]: Unable to end PDF (Randomly)-node.js
The issue was, hummus is processing before fileStream for png image get closed. So, I need to take care of fstream close event...
Read more >Fix for PDF Function in Google Chrome The Problem
Disable the Chrome PDF Viewer by clicking the Disable link. 4. The viewer is now disabled and inactive. 5. Close the Plug-in Window...
Read more >Fullstack Node.js
The Complete Guide to Building Production Apps with Node.js. Written by David Guttman ... server is unable to find the requested data.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the exact same error with the same code (I guess it is from README’s modify sample code), and the error was solved when I changed ‘/path/to/image.jpg’ with an existing image file.
The error message would have room to be improved.
THANKS @chunyenHuang !!! It worked I guess I will make a PR soon to make it clearer that we have to use endPage()