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.

Is it possible to edit scanned PDF files?

See original GitHub issue

I’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);
		// edit 1st page
		// add text to pdf
			.text(project.socinal_contract_id, 420, 64)
		// we MUST use endPage!!
			.text(project.socinal_contract_id, 200 , 343)
			.text(project.socinal_contract_id, 285, 392)
		// 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:closed
  • Created 5 years ago
  • Comments:11 (5 by maintainers)

github_iconTop GitHub Comments

chunyenHuangcommented, Aug 12, 2018

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

chunyenHuangcommented, Aug 11, 2018

@christiansaiki Please update to 1.7.3 It temporarily disables the blocker codes until HummusJS updates.

Read more comments on GitHub >

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

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 Post

No results found

github_iconTop Related Hashnode Post

No results found