I'm using NodeJS to do an app that finds and replaces a text in a pdf. I have found some approaches:
- 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.
- 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.