christian-vigh-phpclasses/PdfToText

Error of 'Undefined Constant 'IMG_JPEG'

Pajservices opened this issue · 7 comments

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

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!

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

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.

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

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