In your specific case you can set the start and end pages of the stripper such that you don't get the full document each time, then use some simple string operations to get what you need.
Here is a complete, more generic working example based on your code.
import org.apache.pdfbox.pdmodel.PDDocument;
import org.apache.pdfbox.text.PDFTextStripper;
import java.io.BufferedInputStream;
import java.io.InputStream;
import java.net.URL;
public class App {
public static void main(String...args) throws Exception {
String path = "..."; // replace with whatever path you need
String startDelimiter = "..."; // replace with wherever the start is
String endDelimiter = "...";
URL url = new URL(path);
InputStream is = url.openStream();
BufferedInputStream fileParse = new BufferedInputStream(is);
PDDocument document = PDDocument.load(fileParse);
PDFTextStripper stripper = new PDFTextStripper();
// set this stuff if you know more or less where it should be in the pdf to avoid stripping the whole thing
stripper.setStartPage(1);
stripper.setEndPage(3);
// get the content
String content = stripper.getText(document);
String searchedContent = content.substring(content.indexOf(startDelimiter), content.indexOf(endDelimiter));
System.out.println(searchedContent);
}
}
If, on the other hand, you don't know where in the document you're looking, with a bit of work you can search the document in order to get the start page and end page or other stuff. See this similar question.