Integrate PDF Download from C#

Hi all,

I have a code written in C# which goes to a web page and reads specific values row by row from a table and then it store the values in a list which is used as parameter to download multiple PDFs. How can I simulate this download? I mean, there’s someway to add the download function from C# to UiPath?

Regards,
Julián

Hello!

You can create a Custom Activity :slight_smile:

Regards,

Hi @Juramirez,

Actually, you may use the Invoke Code activity in order to run VB.net code in UiPath.

Prior to do that, you may convert your C# code to VB .net code by using the following website:

In addition to that, you will probably have to add references before adding some code. You may import assemblies into UiPath here:

:slight_smile:

Thanks @acaciomelo and @Lucas.Pimenta for your answers. I’ve found that from the web page i can get the full route to open the PDF file. Is there anyway to open that URL and force it to download the PDF instead opening in a browser?

Regards,
Julián

You can use the HTTP Request activity to directly download the PDF. Just set the URL as the Endpoint property and input the local file name (including .pdf) for the ResourcePath property.

The HTTP Request activity is part of the uipath.web.activities pack if you haven’t downloaded it already

Hi Dave, I’m already trying it but it appears that the request is using another browser session (not active) and this makes me to login again so it’s not working. I’ve already tried to use Attach Browser but it doesn’t works. How can I make the request in active browser?

Regards,
Julián

Ya that activity always initiates a new session as far as I’m aware. You can pass the credentials in it though if that’s an acceptable solution.

The only other way I know to do it is to right click (if it’s a hyperlink) and click ‘save as’ then save through the dialog box. It’s not ideal as it’s a lot slower and requires you to use the standard right click which means that the browser must be visible.

Another option I haven’t explored is to change the settings in the browser and/or computer the robot is using. There must be a way to auto-download PDFs instead of viewing in browser. I just haven’t looked for it myself

The problem passing credentials is that it requests captcha so it’s not possible. Let me try the last option because second option is already implement but it’s slow.
Thanks!