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

Error of 'Undefined Constant 'IMG_JPEG' #38

Open
Pajservices opened this issue Sep 29, 2020 · 7 comments
Open

Error of 'Undefined Constant 'IMG_JPEG' #38

Pajservices opened this issue Sep 29, 2020 · 7 comments

Comments

@Pajservices
Copy link

Hope someone can help with this. I'm trying to use this pdftotext class in a script that runs without a graphical interface - just to get some text out of a pdf. I'm running it just as a bat file. or command line and getting the error;

Use of undefined constant IMG_JPEG - assumed 'IMG_JPEG' and it's stopping my script.

Any ideas how i fix this.

Thanks in advance

@arathra
Copy link

arathra commented Oct 25, 2020

Can I ask if you made any progress with this? We're having exactly the same problem

PHP Warning: Use of undefined constant IMG_JPEG - assumed 'IMG_JPEG' (this will throw an Error in a future version of PHP)

I'm sure it can't just be the 2 of us!

@Pajservices
Copy link
Author

Hi Arathra- No sorry I didn't, and gave up on it.

I was trying to create forms in pdf for a client - then read the data out. I found PDFFiller instead and am using that. It will export the fields into an excel format for you.

Phil

@arathra
Copy link

arathra commented Oct 26, 2020

Thanks for getting back to me, Phil. Shame about that; I guess that means we'll be looking for an alternative as well. We need to "read" users' PDF uploads so while PDFFiller isn't for us, I'm sure something out there will work.

All the best.

@arathra
Copy link

arathra commented Oct 29, 2020

Hi Phil,

It took a bloody long time but I think I have solved it by using a different PDF converter here: https://github.com/smalot/pdfparser/ along with vendor/autoload.php

It works for me and doesn't produce any errors.

Cheers

@Pajservices
Copy link
Author

Pajservices commented Oct 29, 2020 via email

@niklaus133
Copy link

hi I think I have solved it you need to downgrade your php version to 7.4
the problem is in the version 8 of php

@melvin-merchandisefabriek

I'm sure none of the people that asked this are in need of it anymore but for anyone else that still encounters this error, all you need to do is put the IMG_JPEG in quotes like the error is suggesting.

PHP Warning: Use of undefined constant IMG_JPEG - assumed 'IMG_JPEG' (this will throw an Error in a future version of PHP)

just go to the pdftotext class ctrl+f to find IMG_JPEG and change it to 'IMG_JPEG'

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

4 participants