2

I'm using NodeJS to do an app that finds and replaces a text in a pdf. I have found some approaches:

  1. Using some npm package, like pdfReader, that converts pdf to json. So I get the text and replaces it with what I want. The problem it's convert the output back to pdf.
  2. The possible solution for the first item it's to convert the PDF to HTML, edit the HTML and convert it back to pdf. But most of the tutorials using NodeJS it's about convert HTML to PDF, not PDF to HTML.

Any solutions for this problem?

Update

I ended up using PDFKit to create the pdf files that i need. In my case, this solution don't to cover all the possibles. But if you have to find a word and replace it in an unpredictable pdf file, maybe this problem has no solution in nodeJS. The PDFKit lib has an open issue for this feature.

1
  • Here's the first Google result for "node create pdf": pdfkit.org Commented May 18, 2020 at 21:05

1 Answer 1

0

Look at this approach how to export json data to pdf file with specify format with Nodejs?. Basically uses your idea. Convert PDF to JSON and then render the JSON in html, then convert the HTML to pdf.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.