# PDF Automation using URL opened in Selenium, not a new URL

Currently im using Selenium Webdriver for c# and PDFBox to automate the PDF text of a report. Now, using PDFBox, we have the ability to parse a pdf given a URL link, with URL = new URL("link of pdf");. However, this takes the URL link directly without preconditions.

If I access the pdf that im trying to parse with the direct URL address, I get a resource not found error. I would need to log in to view the actual report, which is done using my Selenium code.

How would I link Selenium with PDFbox, so that instead of the code opening a new URL that goes directly to the Denied Permissions URL, it would go to the PDF Report thats already preloaded on the screen, with the same URL address?

The code I'm trying:

     URL url = new URL("link of url");
BufferedInputStream input = new  BufferedInputStream(url.openStream());
PDFParser parsepdf = new PDFParser(input);
parsepdf.parse();
textofpdf = new PDFTextStripper().getText(parsepdf.getPDDocument())