Invoke Csharp code isn't working inside for loop

Hi Guys,

I am getting the following error while invoking the Csharp code in a for loop. The code is working file independently


“The Invoke method : The process cannot access the file, because it is being used by another process](Invoke method : The process cannot access the file,because it is being used by another process - #23 by Sanjay3630)”

Attached is the workflow can someone please help on this?

Following are the steps that I want to do:

  1. Get the number of pages in a pdf (pdf has scanned receipts in rotated formatted )
  2. Extract all the pages
  3. Rotate the PDF using the Charp code
  4. Read the PDF using OCR

Please note, I have used a sample PDF as I can’t share the actual PDF and this sample PDF is weirdly giving the correct output even when it is rotated but in actual case it is not happening that way, I need to rotate the PDF in order to read it correctly (771.7 KB)

1 Like

Hi @alpharobot,

We are not able to download zip file.Please check.

Omkar P

1 Like

The error states that the process can’t be accessed as it’s used by another process. In this the other process is the loop. As file location is already being used by the loop the csharp code can’t access it.

So you need to create a copy of that file inside the loop, perform the action on the copied file and then you can store the result wherever you want.

This will resolve this issue.


Thanks for the response and for having a look however it is resolved now just as mentioned in the marked solution.

Again, Thanks for the reply!

Thanks, it worked perfectly fine. :+1:

1 Like

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