question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Unable to end PDF

See original GitHub issue

Here 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:closed
  • Created 5 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
akkycommented, May 14, 2019

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.

1reaction
christiansaikicommented, May 24, 2018

THANKS @chunyenHuang !!! It worked I guess I will make a PR soon to make it clearer that we have to use endPage()

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found