Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pdf2json.convertPdf2Json not a function? #5

Open
AdamMarciniak opened this issue Jan 12, 2021 · 5 comments
Open

pdf2json.convertPdf2Json not a function? #5

AdamMarciniak opened this issue Jan 12, 2021 · 5 comments

Comments

@AdamMarciniak
Copy link

I've got code like so:

var pdf2json = require('form-pdf2json')

console.log(pdf2json.convertPdf2Json('formExample.pdf'))

And it gives me :

TypeError: pdf2json.convertPdf2Json is not a function

Is there something I can do to fix this?

@clarekang
Copy link
Owner

Hi,
It seems to be an error caused by the class not being declared correctly.
I think you should change your code like this:

var Pdf2json = require('form-pdf2json');
var pdf2Json = new Pdf2Json();
console.log(pdf2json.convertPdf2Json('formExample.pdf'));

It's been a while since I've seen this code, so I need to check it a lil bit. 😅
But anytime ask me if you have any questions.

@sanatg
Copy link

sanatg commented Feb 1, 2022

Hi tried using the code above @clarekang:

var Pdf2json = require('form-pdf2json'); var pdf2Json = new Pdf2Json(); console.log(pdf2json.convertPdf2Json('./test.pdf'));

but i got an error:

node:internal/fs/utils:344
throw err;
^
Error: ENOENT: no such file or directory, scandir 'files/'

what can i do to resolve it?

@Matojeje
Copy link

Same issue here

@clarekang
Copy link
Owner

I'll check this issue again

@steveharman
Copy link

Similar issue for me.

With the following:

var pdf2json = require("form-pdf2json");
pdf2json.convertPdf2Json("/Users/steveharman/sampleForm.pdf");
pdf2json.exportPdf2Json("/Users/steveharman/sampleForm.json");

When I issue node ./myscript.js (that ^^) I get:

Error: ENOENT: no such file or directory, scandir 'files/'

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants