This was the suggested solution by don_crissti, and I am providing an explanation of it here for users just getting started with Unix and Linux. Feel free to edit, as this summary was written by a novice.
for f in *.pdf; do pdftotext "$f" "/path/to/some/dir/${f%.*}.txt"; done
Now, let's examine each command. Here is a standard for loop that is used to iterate overall all the files in the current working directory. for f in *.pdf. In this command, f is used as the index.
The next command converts the PDF to text. This assumes the user has already installed poppler:
pdftotext "$f" "/path/to/some/dir/${f%.*}.txt"
"$f"is used to hold the name of the input PDF file and "/path/to/some/dir/${f%.*}.txt" specifies the path for the output TXT file, i.e. the target directory /path/to/some/dir/ and the output file name ${f%.*}.txt which is basically the input file name ("$f") with the .pdf extension removed from the file name via parameter substitution and a .txt suffix appended.