Problems with iTextSharp in the custom activity

I created a custom activity for rotating pdf files.

In the c# code I imported iTextSharp library and performed some actions with it. When I did the same code in a separate VS C# project it worked absolutely fine. When I created my custom activity following the steps from the official tutorial from UiPath, it throws me an error when using it:

Rotate PDF : Could not load file or assembly ‘itextsharp, Version=, Culture=neutral, PublicKeyToken=8354ae6d2174ddca’ or one of its dependencies. Не удается найти указанный файл.

My activity takes three input arguments: path to the file, path to the new file, angle of rotation.
So when I pass the path and run the project in UiPath it gives the above error. What should I change to prevent the error?

ActivitiesRotatePDF 1.0.2.nupkg (4.2 KB)

Main.xaml (5.7 KB)

Did you add that library under ‘Dependencies’ while creating the package from Nuget Explorer?

Rammohan B.

@Rammohan91, I’m doing it accordingly to this: is for sale | HugeDomains

Added iTextSharp dependency so now it’s shown in ‘Dependencies’. But when I try to upload the activity it disappeared at all. I mean I can’t even find the activity in the list while it says it has been successfully installed.

UiPath is just going crazy. It shows old folders in the ‘Activity’ panel while I have deleted them. The worst thing is that in the package manager it shows that I have successfully installed my activity but I still can’t see it in the activity list from the left panel. I restarted UiPath a thousand times.

On another computers it says ‘Unable to resolve dependency’. Am I doomed? :frowning:

Yup. That’s the correct way to do it.

I had a similar issue where the activities were not showing up. After cross checking my code in visual studio i realized that i was not setting the output to an output variable. Uninstalled my packages in UiPath and reinstalled with the latest one fixed my issue. Have a look at your code, if you are missing something like this.

Rammohan B.

1 Like

@Rammohan91 Thank you very much. I changed nothing but I launched it on a third PC and it worked there and this was vital.

I have no output variables :slight_smile:

Why can’t I resolve the dependency on another computer? I must blow your mind now so to clarify what’s going on. I developed it on a comp ‘A’ where there was a problem with access to it. Tried it on a comp ‘B’ where it said it couldn’t resolve the dependency. And then tried on a comp ‘C’ where it worked fine. How to resolve dependency on a comp ‘B’, do you have any ideas?

As it worked where it should, thank you very much!

Hhmm. That’s strange. Is there any difference in all 3 system? Are all 3 of them using same version of UiPath Studio?

I would basically try to do a clean install again in such cases. Uninstall your custom activity from Manage Packages. Also make sure that the Folder’s for your custom activities & dependencies doesn’t exists. Restart the Studio and then reinstall the package.

What’s the complete error? Does it throw related to whole ‘iTextSharp’ dependencies or any specifix dll’s? Not sure but i believe there could also be a reason where your dependencies itself may be dependent of some other dll’s and there could be mismatch of version of those 2nd level dependencies between 3 systems.

Rammohan B.

I haven’t noticed any serious differences in the systems. All computers run under the Windows 10 system.
Yeah the error is related to iTextSharp

1 Like