I need to extract a block of text from pdf. This text has the same font-family as characteristics. Any ideas? cheers
Edit: Let me ask the question in other way: How can i extract just the "Bold" text from pdf page?
I need to extract a block of text from pdf. This text has the same font-family as characteristics. Any ideas? cheers
Edit: Let me ask the question in other way: How can i extract just the "Bold" text from pdf page?
public String pdftoText(String fileName){
try {
File f = new File(fileName);
if (!f.isFile()) {
System.out.println("File not exist.");
return null;
}
parser = new PDFParser(new FileInputStream(f));
parser.parse();
cosDoc = parser.getDocument();
pdfStripper = new PDFTextStripper();
pdDoc = new PDDocument(cosDoc);
parsedText = pdfStripper.getText(pdDoc);
cosDoc.close();
pdDoc.close();
return parsedText;
} catch (IOException ex) {
Logger.getLogger(PDFTextParser.class.getName()).log(Level.SEVERE, null, ex);
return null;
}
}
Before run:add pdfbox.jar to your project