Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9221669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T03:37:35+00:00 2026-06-18T03:37:35+00:00

I am trying to convert a pdf file into text file. When I run

  • 0

I am trying to convert a pdf file into text file. When I run the command through terminal its working fine but when try to execute it through PHP it’s not working.

I am stuck in this situation from last four hour spend lots of time in google but no solution available. Can any body resolve this issue?

File owner – nobody

shell_exec('/usr/bin/pdftotext /opt/lampp/htdocs/foldername/filename.pdf');

Can anyone provide any helpful solution?

I also tried to change usr folder ownership from root to nobody and provide 777 permission on folder and its context.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T03:37:36+00:00Added an answer on June 18, 2026 at 3:37 am

    Your command to run pdftotext is not correct.

    There should be a second argument telling pdftotext to write to a specific file or just use a dash “-” to write to stdout, unless you actually want the program to create a text-file with the filename as the pdf (this would require write permissions in the /opt/lampp/…/ folder)

    This is at least true for pdftotext version 0.12.4

    “Pdftotext reads the PDF file, PDF-file, and writes a text file, text-file. If text-file is not specified, pdftotext converts file.pdf
    to file.txt. If text-file is ´-‘, the text is sent to stdout.”

    So, the solution to your question would simply be add a dash after the filename, like so:

    <?php
    $pdftext = shell_exec('/usr/bin/pdftotext /opt/lampp/htdocs/foldername/filename.pdf -');
    echo $pdftext;
    

    Provided that the binary exists and PHP is allowed to use shell_exec and you have permissions and that the pdf-file exists and you have permissions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to convert a binary data to its original format .PDF, but
I'm trying to use the command line program convert to take a PDF into
I am trying to convert a multi-page PDF file into a bunch of JPEGs,
Trying to convert this c code into MIPS and run it in SPIM. int
I am trying to convert image file (jpeg) in to pdf file in my
I'm using reportlab to convert some big library (plain text in Russian) into pdf
i am trying to read a html file and convert it to pdf using
I am trying to convert HTML into a PDF document in Django and haven't
I am trying to extract text from pdf and write it into a json
I am trying to convert PDF to JPG file with this code: $pdf_file =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.