I am using this piece of code to read through a pdf file but I am not sure how to extract font style information (like whether it's bold or not) from the text. This library is fairly old so if there is a newer way of doing this, suggestions are welcome.
System.out.println("Reading pdf " + filename + ".pdf...");
PDDocument document = PDDocument.load(file);
PDFTextStripper pdfStripper = new PDFTextStripper();
String text = pdfStripper.getText(document);