Я использую pdfbox для преобразования pdf в txt, но у меня есть несколько файлов в папке, которые нужно создать в разных txt файлах по одному.Мой исходный код
public class PDFconversion
{
public static void main(final String[] args) throws IOException,SAXException, TikaException
{
//Assume sample.txt is in your current directory
File file = new File("sourcefile");
//parse method parameters
FileInputStream inputstream = new FileInputStream(file);
BodyContentHandler handler = new BodyContentHandler();
Metadata metadata = new Metadata();
metadata.set("org.apache.tika.parser.pdf.sortbyposition", "true");
ParseContext pcontext = new ParseContext();
PDFParser pdfparser = new PDFParser();
System.out.println("Parsing PDF to TEXT...");
pdfparser.parse(inputstream, handler, metadata, pcontext);
FileWriter fw=new FileWriter("targetfile");
//parsing the file
fw.write(handler.toString().trim());
//System.out.println("Contents of the document:" + handler.toString());
}
}