Is it possible to edit scanned PDF files?
See original GitHub issueI’m pretty pleased to use this awesome library! Thank you so much @chunyenHuang
Nevertheless I’m having trouble to edit a scanned PDF file.
I keep getting Segmentation fault: 11
I do not have any other log from the project
My current code is
const projectExample = {
socinal_contract_id: '222222222'
};
/**
* addContractIdInPdf - this function is responsible for adding the CCB Number
* into an already signed and scanned contract
* It will return the path of the new pdf file
* @param {Object} project - a project object from MongoDB
* @param {String} inputPath - the path of the pdf file that will be processed
* @return {String} outputPath - the path to the new pdf file
*/
function addContractIdInPdf (project, inputPath) {
return new Promise((resolve) => {
const pathWithoutExtension = inputPath.replace(/\.[^/.]+$/, '');
const newFilePath = `${pathWithoutExtension}_with_contract_id.pdf`;
const pdfDoc = new HummusRecipe(inputPath, newFilePath);
pdfDoc
// edit 1st page
.editPage(1)
// add text to pdf
.text(project.socinal_contract_id, 420, 64)
// we MUST use endPage!!
.endPage()
.editPage(7)
.text(project.socinal_contract_id, 200 , 343)
.text(project.socinal_contract_id, 285, 392)
.endPage()
// end and save
.endPDF(() => resolve(newFilePath));
});
}
addContractIdInPdf(projectExample, '/tmp/02121402.pdf')
.then((path) => console.log(path))
It works perfectly for digital pdf files, and it doesn’t work for scanned pdf files. Thank you so much for your help
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
How to Edit Scanned PDF Files Quickly
Modify the text on your PDF by clicking the "Edit" icon on the top-right toolbar. Click anywhere on the document to add, delete,...
Read more >3 Methods | How to Edit a Scanned PDF Document in 2022
A scanned PDF document may prevent you from editing items like text, images, and forms. Therefore, you can make it editable by using...
Read more >How to Edit a Scanned PDF Document in 3 Quick Ways
The method to do that is to go to “File” > “Open”, select a PDF to open it, and click “OK” in the...
Read more >how to edit scanned document | Free | Foxit - YouTube
Transcript · Webinar: PhantomPDF A Multi-Feature PDF Editor · Best FREE PDF Editor · Convert Paper Documents into Editable Word Document · How ......
Read more >Guide on How to Edit Scanned PDF with Adobe Acrobat
Click on the "Edit" button and select the now readable text content in PDF files in order to begin editing. If you highlight...
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
Hi, this issue has been resolved by Gal in HummusJS. I have also updated the HummusRecipe and put the info function back. Please update your package to
hummus-recipe@1.7.4
@christiansaiki Please update to 1.7.3 It temporarily disables the blocker codes until HummusJS updates.