How to pass pdf file as argument while invoking an automation process via API calls provided by UiPath?

I want to integrate the UiPath call with my .net call. What I am trying to achieve here is that I want to pass the file that I am getting as input through my .net API call to the process that I made in UiPath. How to achieve that? Can anyone help me with that?

Hi @Umer_Shahid,

Thanks for reaching out UiPath Community.

try converting the file to Base64 String and then try to pass.

Hope this works for you.

Happy Automation,
@Vinit_Kawle

Ok if i pass it as base 64 string. How to deal with that in UiPath? The read pdf activity expects the location of the file as input. How to convert base 64 to a file? Like how to download that in UiPath?

Hi @Umer_Shahid ,

Please use the below code to convert the base64 to file

// base64BinaryStr is your base64 string, this need to be converted to an array before 
// write it to a pdf file
byte[] bytes = Convert.FromBase64String(base64BinaryStr); 
// Import System.IO namespace before adding this  fucntion, 
// replace your file and folder name as needed or add your destination path
// write the byte array to the file
File.WriteAllBytes(@"FolderPath\pdfFileName.pdf", bytes );

Edit : use the file location which is already written at the destination in your read pdf activity

Let me know if it works

Srini

Pass the path and filename, not the file itself. You can’t have a file as an argument to a Job. Job arguments only accept simple datatypes. Converting to base64 and passing as a string should work but you’re overcomplicating things. Just pass the path and filename.

For sure. Lemme try this and I’ll let you know.

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.