0

the best way to solve this was to use "pdftotext" that is in the "xpdf" package but in all shared hosts that i googled shell_exec is disabled . i found alternative metods that used only php like a function called pdf2string() (on php.net) but none of those functions didn't work as expected (with some pdf files they just didn't output correct text and with some other pdf they didn't output nothing and some other versions of this function just didnt work at all so i excluded this option). any way to convert that open source pdftotext into a php script ? (source is in c++ i think and can be found here : http://www.foolabs.com/xpdf/download.html) . any other solution will be accepted as far as it gives to me text output of the pdf (the correct one)

3
  • Probably the best solution is to figure out why the PHP libraries you tried didn't work. You should specify the ones you used and what happened with each one. It's much more likely that you'll be able to find someone who knows how they work and how to fix your problem than that you'll find someone who wants to reimplement pdftotext in PHP... Commented Apr 18, 2012 at 22:43
  • @octern i dont know vary much about pdf (and im not interesed in) so i cant figure out why they didnt work Commented Apr 18, 2012 at 22:45
  • already found another one . was the last chance Commented Apr 20, 2012 at 12:00

1 Answer 1

3

Since you have a restricted environment, you may want to look at this. http://webcheatsheet.com/php/reading_clean_text_from_pdf.php

This uses no external library to parse pdf to text formats. However, since this parse text out of raw pdf format, i m not sure how stable it is.

Sign up to request clarification or add additional context in comments.

3 Comments

i have took a look at that website for 3 looooong nights and in the end i got nothing to call a solution to my problem . that function worked partially but not for some pdf files
As i said, i m not too sure how stable that code is. Does your server support popen class of functions (i doubt)? That will be another way of doing it with pdf2text.
As of 2022-Jul-2, the WebCheatSheet.com site doesn't work (in http or https).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.