Converting PDF to .txt File

Discussion in 'Programming/Scripts' started by badben, Dec 7, 2005.

  1. badben

    badben ISPConfig Developer ISPConfig Developer

    Does anybody know if it is possible to convert a pdf file to a plain text file using php so that my site search engine can index it?

    I can't seem to find anything.
     
  2. falko

    falko Super Moderator ISPConfig Developer

  3. till

    till Super Moderator Staff Member ISPConfig Developer

  4. sbovisjb1

    sbovisjb1 ISPConfig Developer ISPConfig Developer

    Here is a script to index the stuff

    Well idk if this would work... oh well
    # Ex: matches [ -q ] string globpattern
    # Does $1 match the glob expr $2 ?
    # -q flag = set return status to 0 (true) or 1 (false)
    # no -q flag = echo "1" (true) or "0" (false)
    # Unfortunately, the return status is opposite from the echo'ed string
    globmatches () {
    if [ $1 = "-q" ]; then
    shift
    case "$1" in
    $2 ) true ;;
    * ) false ;;
    esac
    else
    case "$1" in
    $2 ) echo 1 ; true ;;
    * ) echo 0 ; false ;;
    esac
    fi
    }

    if globmatches -q $file "*.txt" ; then
    echo "Found a txt file"
    elif globmatches -q $file "*pdf" ; then
    echo "Found a pdf file"
    if
     

Share This Page