#!/bin/sh
#] 
#] *********************
#] $ bash   "$d_bin""pdfToText directory.sh"  - convert pdfs in a directory to text, same fnames
# www.BillHowell.ca  09Apr2021 initial

# downloaded paper pdfs must have filenames of the form $pdfraw" (see "process_it" below)


#**********************************
# Setup - header file

source "$d_bin""review header.sh"

p_fileList="$d_temp""pdfToText directory fileList.txt"


#*********************************

#] path_pdfToText()  - 

	path_pdfToText() 
{  pdftotext  "$1"  "$2"  
}  




#] dir_pdfToText()  - 

	dir_pdfToText()
{  
d_inn="$1"
d_out="$2"

find  "$d_inn"  -maxdepth 1  -type f  -name "*.pdf"  |  sed 's#.*/\(.*\)#\1#'  >"$p_fileList"

while read -u 9 line; do
	#	echo	  										"$line"".txt"  
		pdftotext  "$d_inn""$line"  "$d_out""$line"".txt"  
done 9< "$p_fileList" 
}  


#	d_PuetzLetter="$d_PROJECTS""Investments/Puetz newsletter/"
#	dir_pdfToText  "$d_PuetzLetter"					"$d_PuetzLetter/pdfToText/"  
#	dir_pdfToText  "$d_PuetzLetter/z_Archive/"	"$d_PuetzLetter/pdfToText/"  

#	pdf is an image file
#	d_Sundowners="$d_PROJECTS""9_My sports & clubs/Sundowners/"  
#	path_pdfToText  "$d_Sundowners""210528 Aberta.ca health-cmoh-record-of-decision-cmoh-order-30-2021.pdf"  	"$d_Sundowners""210528 Aberta.ca health-cmoh-record-of-decision-cmoh-order-30-2021.txt"  




# $ bash  "$d_bin""pdfToText directory.sh"  


# enddoc
