Downloading a local pdf

I’m trying to set up my bot so that when it clicks a link that causes a unique PDF to be generated, the the file is downloaded. The problem is that the PDF is a locally hosted pdf because it’s unique to the user so when I used the HTTP library, the file that gets downloaded is just a blank white page. None of the text or graphics appear on the file. Is there another workaround to get the file downloaded?

Hello and welcome to forum :wave:
How would user download the file? Problem is that http library has no information about user session.

Basically, our bot logs into a website for us and some information is inputted on the website and we want our bot to click this button that basically generates a pdf for us with the specific information that was inputted and then we want to download the pdf. But when we do this, our pdf is just blank.

The key for solving this problem is understanding why that PDF is blank. If it can be downloaded in the first place, it means that you’re still able to get the generated URL, but most probably the server expects to receive the session cookie as well during the PDF content retrieval (so the request is “authenticated”).

Luckily, the RPA.HTTP library supports sessions (so cookies post-auth are remembered and added to the headers) and most probably you need to create one with Create Session. Then you’d use * On Session type of keywords in order to make requests over the previously created session.

If above doesn’t work at all, try as a workaround with the Browser automation approach, by using one of these two:

1 Like

In addition Playwrights Download supports session, so you could get file from url.

1 Like