Unable to Close PDF File Opened by Stream Reader

Hi All,

I’m trying read PDF and classify them based on number of pages on the PDF.

When I move try to move the file. I get the following error.

Error Message:
“message”: “Move file : The process cannot access the file because it is being used by another process.”,
“level”: “Error”,


I use following flow to count the page number.

PageCount.xaml (9.1 KB)

What is the best way to end the StreamReader before I move the file?


Hi, I need help with this too, have you solved this problem?
Could you share the solution please?

1 Like

I know this is late reply but it may be helpful for someone, I have solve it by “Invoke code” activity and create an argument(in_SR) Direction = In , type = System.IO.StreamReader and Value = SR and write below code in invoke code:



I confirm the solution of @Nhadapkar

1 Like

If my replay was helpful please mark it as solution to close this topic :slight_smile:

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