Automatic cleaning before ending

Hi everyone!

I am working to automate a process to convert each page of a pdf file to a image file.

The process is like

  • Open PDF
  • Capture Actual page - correct capture

While loop until actual page = total page

  • Click in the middle of a page
  • Ctrl C
  • Open Paint
  • Ctrl V
  • Save paint
  • Intro in pdf to go to the next page
  • capture actual page again -correct capture

The first loop is perfect. I could see that the robot makes the intro in PDF document correctly and pass page.
But, when the Robot open paint in the second loop the PDF go back to first page automatically. (I mean I could save first and second page)

So I couldn’t catch third o fourth page.

I checked the selectors trying to find something wrong, but I didn’t find anything because I modify to general PDF and I have the same problem with different one.

Has someone any idea to solve this problem?

Thank you in advance

Why don’t you use save Image activity instead of Paint? Are you consolidating all the images of PDF/

Well, the problem is not to save with paint, the problem is when I am saving, the application PDF go back to the first page.
Moreover, the activity save image doesn’t recognize pdf files.

OkI thought you are taking screenshots of Pdf page and saving them.

Since you are opening paint which is a different application, probably PDF is not
Staying on the page it is supppsed to be.

just an fyi…If you are capturing image in PDF and want to save locally, you could try in below way instead of opening paint.Since your PDF image is in the clipboard, you could extract and save your clipboard(System.Windows.Forms.Clipboard VariableType) image(System.Drawing.Image Variable Type).


1 Like

It is working perfectly!! Thank you so much!!

I think I have to study variables types deeper…

Hey @vvaidya,

I am trying something you have done. I am getting the image on the clipboard, but I get this error while saving it. But, when I remove excel scope and just run the clipboard (which has the picture on it) and save, it does save whatever is on my clipboard. So confusing.

book.xlsx (15.1 KB)
saveimage.xaml (21.1 KB)

I have seen this issue in other topics as well. If your filename is in correct format, can you try below things:

  1. Assuming issue with Uipath.Core.Image Type

Change Image Variable type to System.Drawing.Image instead of UiPath.Core.Image and see it works.

  1. (AND/OR) Assuming issue with Save Image activity.

Try Invoke Method and see if you are able to save the Image.

Target- Image

Method – SaveFile

Parameter – String – yourfile name variable



Hey Vinay,

I tried that man. Using Invoke method, still get the same issue. I introduced delay, just to make sure the process isn’t fast enough. Still no luck.


saveimage has thrown an exception

Source: Invoke method

Message: Save image failed. Check if the file name is a valid path

Exception Type: ImageOperationException

UiPath.Core.ImageOperationException: Save image failed. Check if the file name is a valid path —> System.NullReferenceException: Object reference not set to an instance of an object.
at UiPath.Core.Image.SaveFile(String fileName)
— End of inner exception stack trace —
at System.Activities.Statements.MethodExecutor.InvokeAndUnwrapExceptions(Func`3 func, Object targetInstance, Object actualParameters)
at System.Activities.Statements.MethodResolver.SyncMethodExecutor.BeginMakeMethodCall(AsyncCodeActivityContext context, Object target, AsyncCallback callback, Object state)
at System.Activities.Statements.MethodExecutor.BeginExecuteMethod(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
at System.Activities.Statements.InvokeMethod.BeginExecute(AsyncCodeActivityContext context, AsyncCallback callback, Object state)
at System.Activities.AsyncCodeActivity.InternalExecute(ActivityInstance instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.ActivityInstance.Execute(ActivityExecutor executor, BookmarkManager bookmarkManager)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)