I've been using PowerShell ISE, but I downloaded VS Code instead and installed the PowerShell extension.
This allowed me to view the script variables easily. The $pdf_text
variable turned out to be an array instead of a string.
I needed to explicitly join the lines as follows:
foreach ($file in $files) {
$pdf_text = & $folder_pdftotext_exe -f 1 -l 1 -raw $file -
$pdf_text = $pdf_text -join "`n"
The script now works. I fail to understand why the script would have ever worked before. Regardless, problem solved.