I am facing the following problem: I have a 590-page PDF and I need to create a script that looks for a specific record number, cut out the page it is on, and then generate a new PDF with that page. So far, I've managed to extract all the text from the PDF (something very simple). I was also able to generate a new file generated by the page using lib scissors, according to the code below:
let pdf = scissors(filePath)
.pages(258)
pdf.pdfStream()
.pipe(fs.createWriteStream("inscricao.pdf"))
.on("finish", function(){
console.log("Success... Exiting")
}).on("error", function(err){
throw err;
})
In .pages(), the number 1 refers to the first page of the PDF. I thought about looking for the registration number, taking the page number that is in the PDF and putting it in .pages(), to cut that page directly. However, I don't know how to implement this logic, or what lib to use. If you can give me a light ...
Thank you very much in advance