Table of content

Creating UiPath Library

A Library is a package that contains multiple reusable components. Libraries are saved as .nupkg files and can be installed as dependencies to workflows using Package Manager.

Creating a library is similar to Creating a Basic Process.

The difference is, packages are for creating reusable components to be used in the context of other projects.

Let us create a new custom library that can be used to convert files from one format to another format. Create a new Library called File_Conversion.

file-conversion-library-rpa-uipath

Once the UiPath Studio has opened, go to the Project pane and select the Rename option.
rename-activity-in-new-library-rpa-uipath

I am going to design a library where it is going to convert the PDF to Text format. So I am naming my new activity as PDF to Text File
pdf-to-text-file-rpa-uipath

Next, you have to install the PDF package through Manage Packages. Go to the Manage Package and search for PDF activities under Official.


uipath-pdf-activity-rpa

You will find UiPath.PDF.Activities, Select it and then click on the Install button

install-pdf-activities-rpa-uipath

Once it is installed successfully, then click on Save and then accept the agreement.


i-accept-rpa-uipath

Once the PDF activity has successfully installed, go to the UiPath Studio and drag and drop the Sequence and then add Read PDF Text activity inside the sequence.
read-pdf-text-activity-inside -the-sequence-rpa-uipath

The First activity which we are going to do here is to convert PDF to Text File, for that you don't need to create any content because this activity may be used in any other program or any other users. Instead of creating variables, create arguments which we are going to use to get input from the users or from other programs.

So let us create new arguments, the first one I need is an inputpdffiles and the next one is outputpath that means at which Path they wanted to save the text file, and the third one is outputfilename.
arguments-tp-pdf-to-text-convert-rpa-uipath

Enter the inputpdffiles inside the Read PDF Text activity and create a new variable in the variable pane for output property in the Properties Pane.

Add Write Text File activity inside the sequence and then enter the outputpath argument and outputfilename argument, as shown below.
write-text-file-activity-rpa-uipath

Now the contents of the PDF are read, and then the contents are transferred and written into the text file, this is how we are going to convert the content of PDF to Text.

As we do not have variables, we have arguments so we cannot be able to run the sequence; instead, we can publish this library and can be used in other programs.

Now, Save and click on the Publish tab on the Design Ribbon pane. Once the Publish Library wizard opened, click on the custom URL and select the Path (I have created the Libraries folder in the Documents folder) to save your file, and then click on Publish.
custom-publish-rpa-uipath

Once it is successfully published, you will receive the below message.
successfully-published-rpa-uipath

If you open your libraries folder, you can see a nupkg package that can be taken to any system so that we can use it for converting a PDF to a Text file.
file-conversion-nuo-kg-rpa-uipath

Now let us go ahead and create a new process. I am creating a new process called Custom_Activity_Examples.

custom-activity-example-rpa-uipath

We have created a PDF Package, Now, go to the Manage Packages and then go to the settings and then add your package source inside the Manage Packages.

Click on Manage Packages, and then go to settings under Manage Packages and then click on the + symbol in the User Defined package sources.
settings-under-manage-packages-rpa-uipath

After clicking on + symbol, give a name to package in the Name box and then enter the Path of your .nupkg file in the source box as shown below and then click on Add
add-name-and-source-and-then-click-on-add-rpa-uipath

After adding, you can see your LocalPackages under Manage Packages.
localpackages-under-manage-packages-rpa-uipath

Now click on File_Conversion and then click on the Install button, and also, you can see the dependencies which are available in this package.

depencies-of-local-packages-rpa

After installing, click on the Save button and then accept the agreement.
after-installing-i-accept-rpa-uipath

Once the process has opened in the UiPath Studio, If you search for File conversion activity in the Activities pane, you will find it.

file-conversion-activity-inside-rpa-uipath

Next, add Sequence inside the Designer pane and then add PDF to Text File activity inside the sequence.
pdf-to-text-activity-inside-the-sequence-rpa-uipath

Click on the PDF to Text File and enter the inputpdffile name to convert it to the text file in Properties Pane. I have many PDF files, so I am taking those files to convert.
sample-convert-to-text-rpa-uipath

And also, enter the Output file name and the Path for the Output file in the Properties Pane.
output-file-name-rpa-uipath

output-file-path-rpa-uipath

Now, Save and Run the sequence; after the execution, the PDF file will be converted to Text format.
sample-to-text-rpa-uipath

So we have successfully converted PDF files to the Text file.