HTTP Request: Destroys downloaded PDF¨s

studio
http

#1

Hi guys,

I am using the HTTP Request activity to download multiple PDF¨s.

The files are saved and there is no errors while running the workflow.

However,
when I try to open the PDF¨s get an error message saying that Acrobat Reader DC cannot open the file and that the file type are not supported or the file is damaged.

The only entries I fill into the HTTP Request activity is

  1. End Point
  2. Resource Path.

Solutions?

thx


#2

Hello.

What type of request are you using and are what extension are you specifying for the request? Keep in mind that the link for the download might not be available.

Regards,
Cosmin


#3

I pretty much do the same. Does this happen when you do manually? Can you share one link that you are using so i can try on my end, may be something to do with your Acrobat Reader.


#4

Hi,

I tested dowloading PDF¨s on open web pages employing the HTTP Request activity, which worked fine. The files I want to access is stored on protected area. Thus, I guess the authorization fields on the HTTP Request has to be filled?


#5

Hi every one

I kind of stumbled onto the a version of the same problem. I tried to download a pdf from invoice-generator webpage. However when using the HTTP Request with EndPpoint property the URL and ResourcePath property the local file name a (.pdf), I get a pdf that has an error message saying that the file has been damaged or type is not supported.

Maybe there is a property wrong?
Given its an open website, i don’t think any authorization fields should be filed f.e.?


#6

i faced same issue and had it fixed after providing username and password


#7

Are you referring to the Simple Authentication property? Where exactly do you find the username and password? I tried using the same credentials that were used to originally log into the web app, but that didn’t work.

EDIT: The status code is showing “200” which means it’s OK, but I still get the error message in the 1st post when attempting to open the PDF

I’m currently using right click–>save as–>type into activities to save PDFs, but this method would be so much quicker & more reliable if I could get it to work


#8

Try add these to respective properties.

Response.ContentType = “Application/pdf”;
Response.AppendHeader(“Content-Disposition", "attachment; filename=Filename.pdf”);


#9

I tried following by updating the BodyFormat and adding an In argument for Headers as seen below.

However, I opened the file that was saved (test1.pdf) with notepad++ and noticed it looked like an HTML file. I changed it the file extension to .html and attached it. It definitely has to do with invalid login credentials. I’m wondering if it’s an issue where the Simple Authentication isn’t passing the credentials properly? I’m using the exact same variables for username and password that I do to log into the application’s user interface - is that supposed to be using different credentials?
test1.html (14.8 KB)


#10

For anyone in the future that sees this - it turns out that UiPath was not passing the username and password arguments. I looked at the error I was previously receiving by opening the file in notepad++ and noticed it was looking for arguments “userid” and “pwd”. I then created two Arguments for the Headers for userid and pwd.

Once performing the above steps, the PDF was downloaded successfully. No need to enter anything into the Simple Authentication, OAuth1, or OAuth2 fields if you use the headers to pass your authentication info


#11

Hi, how do you add those properties?


#12

Hi I too get error, when I am trying to open PDF file downloaded in HTTP request. can you please help.


#13

Hi @sjaagde6,

Can you try this to download check it.

Regards
Balamurugan.S


#15

Where did you provide this?


#16

I used a HTTP request to get the statusCode. Everytime I cannot open the PDF file, the 404 statuscode is given. If statuscode is 200, the PDF works. However, this is not stable. Does somebody has a solution for this?


#17

Hi @rrvdw

404 is a standard response that indicates that the file is not available: