Answer the question
In order to leave comments, you need to log in
What is wrong with pdfbox???
String text = "";
/*В этом месте всегда ругается на данную строку. Пишет (PDFParser (org.apache.pdfbox.io.RandomAccessRead)
in PDFParser cannot be applied to (java.io.FileInputStream))*/
pdfParser = new PDFParser(new FileInputStream(filePath));
pdfParser.parse();
cosDocument = pdfParser.getDocument();
pdfTextStripper = new PDFTextStripper();
pdDocument = new PDDocument(cosDocument);
pdDocument.getNumberOfPages();
pdfTextStripper.setStartPage(1);
pdfTextStripper.setEndPage(10);
// reading text from page 1 to 10
// if you want to get text from full pdf file use this code
// pdfStripper.setEndPage(pdDoc.getNumberOfPages());
text = pdfTextStripper.getText(pdDocument);
return text;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question