PublicI / pdf-gcv-ocr

Tool to OCR PDFs using Google Cloud Vision
38 stars 9 forks source link

ReferenceError: html2pdf is not defined #2

Open kynoptic opened 5 years ago

kynoptic commented 5 years ago

When running this tool, I get the following error:

ReferenceError: html2pdf is not defined
    at /Users/username/Downloads/pdf-gcv-ocr-master/node_modules/jspdf/dist/jspdf.min.js:202:16291
    at /Users/username/Downloads/pdf-gcv-ocr-master/node_modules/jspdf/dist/jspdf.min.js:1:62
    at Object.<anonymous> (/Users/username/Downloads/pdf-gcv-ocr-master/node_modules/jspdf/dist/jspdf.min.js:1:66)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! pdf_ocr_gcv@1.0.0 ocr: `node index.js ocr "/Users/username/Downloads/pdf-gcv-ocr-master/pdf-name.pdf"`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the pdf_ocr_gcv@1.0.0 ocr script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/username/.npm/_logs/2019-08-27T13_54_23_774Z-debug.log

> pdf_ocr_gcv@1.0.0 hocr /Users/username/Downloads/pdf-gcv-ocr-master
> ./makehOCR.sh "/Users/username/Downloads/pdf-gcv-ocr-master/pdf-name.pdf_ocr"

Provided argument is not a directory

> pdf_ocr_gcv@1.0.0 pdf /Users/username/Downloads/pdf-gcv-ocr-master
> ./makePDF.sh "/Users/username/Downloads/pdf-gcv-ocr-master/pdf-name.pdf_ocr"

Provided argument is not a directory
Name-MacBook-Pro-2:pdf-gcv-ocr-master username$ 
pratheekrebala commented 5 years ago

Thanks for taking the time to raise this issue. Would you be able to provide us with the PDF file you are using so we could try and re-create this issue?

kynoptic commented 5 years ago

Sure thing, the PDF is available here: julia-no-text-short.pdf

chriszs commented 5 years ago

Able to reproduce when installing with npm install. Installing with yarn gave me a likely unrelated GRPC build error.

kynoptic commented 5 years ago

For what it's worth, I tried again using the fork from @ailintom, but still had the same issue.

Let me know if there's anything else I can do to help!

calitidexvii commented 4 years ago

This is related to issue 2462 with the jsPDF dependency. You can fix this by editing package.json to use an older version of jsPDF before the error was introduced. Simply change line 14 from "jspdf": "^1.3.5", to "jspdf": "1.3.5", then re-run npm install.