Reading PDF in new Browser Tab and verify text,elements etc

Hey, my goal is to check a PDF that opens in a new tab (any browser). I used Fontbox and PDF box to check the pdf. I created a keyword that is meant to read PDF:

public class PDFReader {
@Keyword
def ReadPDF(String PDFURL) {
URL TestURL = new URL(PDFURL);
BufferedInputStream bis = new BufferedInputStream(TestURL.openStream());
PDDocument doc = PDDocument.load(bis);
String pdfText = new PDFTextStripper().getText(doc);
doc.close();
bis.close();
println(pdfText);
}
}

. But unfortunately when I try to use a keyword to read me data from a new browser tab, the second browser window seems to be inactive so I have to substitute a ready link to the PDF to make it work. Is there any other solution to read and parse the PDF from the second window?

did you handle the 2nd window properly?

it doesn’t locate me the second window, doesn’t read the cheap title or anything. it only switches to the second window but there is no action there

first, please try to locate and handle the new tab/window. once this is done, PDF work parsing can be done

but WebUI.getWindowIndex(), WebUI.getWindowTitle() these options do not work.
WebUI.switchToWindowIndex() works fine.