Using a custom PDF Conversion Activity in a real world UiPath workflow

In our previous post, we created our very first custom ‘Convert To PDF‘ workflow activity. Let’s use that activity to automate a business process to show how it works in a real-world scenario.

Scenario: Convert all files from one folder to PDF and then save them to a different destination folder.


This series consist of the following parts:

  1. Generate PDFs using UiPath (part 1).
  2. Creating a reusable UiPath activity (part 2).
  3. Using a custom PDF Conversion Activity in a real world UiPath workflow (this post).


Before we begin, please make sure the following prerequisites are in place:

  1. Muhimbi PDF Converter Online full, Free or Trial subscription (Sign up).
  2. Appropriate privileges to create UiPath RPA workflows.
  3. Download / Create the Custom activity as per this article.


Step 1:

  • Open ‘UiPath Studio‘ and create a new Project of type ‘Process‘.
  • Give the new, blank, process a meaningful ‘Name‘, ‘Location‘, ‘Description‘ (optional), and click on ‘Create‘.
IJiPath Studio 
Open 
Open 
Close 
Tools 
Settings 
Help 
Opath 
studio 2019.12_o-beta61 
Community License 
EXE Installer 
Open a Local Project 
Navigate and open an existing project 
Clone or Check Out 
Open from source control repositories like GIT, 
O en Recent 
New Blank process 
New Blank Process 
Start with a blank project to design a new automation process. 
Name 
Location 
Description 
MuhimbiDemo 
understanding Muhimbi REST API 
IFS or SVN 
C reate 
New Project 
process 
Start with a blank project to design a new automation 
p roc ess_ 
Library 
Create reusable components and publish them together as a 
library. Libraries can be added as dependencies to 
automation processes. 
New from Template 
Orchestration Process 
Implement a process through service orchestration and 
human intervention as well as through long-running 
transactions. 
Background Process 
Create a process that does not require user interaction 
and can run as a background process. Multiple 
background processes can run concurrently on the Sam... 
Robotic Enterprise Framework 
Create a transactional business process that follows best 
practices for large scale deployments. 
Trigger Based Attended Automation 
Trigger an automation in response to a mouse or 
keyboard user event. 
Transactional Process

Step 2:

  • In the ‘UiPath Studio‘, click on the ‘Design‘ tab, then click ‘New‘ and select ‘Sequence‘ from the drop down menu.
  • Give the ‘New Sequence‘ a ‘Name‘, ‘Location‘, and then click on ‘Create‘.
DESIGN 
DEBUG 
I IiD*th - 
New 
Save Save as Debug 
Template 
cut 
Copy 
e 
Paste 
Error List 
Manage 
Packages 
Screen 
Scraping 
New Sequence 
New Sequence 
Expor 
to Excel 
Publish 
Scraping 
Events • 
Explorer 
Create a new sequence workflow 
Name 
Location 
MuhimbiFirstWorkflow8 
Go to Documentation 
Remove Unused 
Variables 
Create 
Output 
Breakpoints 
O 
+ Add TO Source Control •

Step 3:

Create the variables with reference to the screenshot below.

Note: You can add set the ‘varDestination‘ output folder to the folder of you choice.

Step 4:

  • Add the ‘Select Folder‘ activity in the ‘Sequence‘.
  • Set its ‘Output‘ property ‘SelectedFolder‘ to the ‘varSourceFolder‘ variable.
DESIGN 
New Save Save as 
Template 
'uhimbiFi 
DEBUG 
UiPath Studio - MuhimbiProject 
Debug 
File. 
'S. cut 
e 
Paste 
Manage 
Packages 
Re CO rdng 
Screen 
Scraping 
Explorer 
Remove Unused 
Variables 
Analyze 
File 
Export 
Publish 
Scraping 
Events • 
aroperTies 
UiPath.CoreActivities.SelectFolder 
Variables Arguments 
MuhimbiFirstWorkf10W 
Imports 
Select Folder 
Select Folder 
DisplayName 
Misc 
Private 
Output 
SelectedFolder 
Output Breakpoints Error List 
O 
Select Folder 
varSourceFoIde 
+ Add To Source Control •

Step 5:

Now we’ll retrieve all the files from the folder and store them in an array variable.

  • Add the ‘Select Folder‘ activity in the ‘Sequence‘.
  • Set ‘varFileArray‘ to ‘Directory.GetFiles(varSourceFolder)‘.
Ⅵ n 寸 Wo , k w M W 。 丨 ow 
「 〕 Select Folder 
Expand ( 0 P 
SystemActiviuesStatementsAssign 
Common 
DisplayName 
varFileArray 
, 0 丨 cto 丨 y ( , 
Variables 
n 
| mPO 心

Step 6:

Now , we’ll loop through the array variable to processindividual files.

  • Add the ‘For each‘ activity in the ‘Sequence‘.
  • Set the Values to ‘varFileArray‘ variable.
DESIGN 
DEBUG 
UiPath Studio 
- MuhimbiProject 
Manage 
Packages 
Explorer 
Remove Unused 
VZriabIes 
Analyze 
o 
publish 
x 
New Save Save as Debug 
Template File • 
VuhlmhlFlrstWorkfIow • 
MuhimbiFirstWorkflow 
Copy 
paste 
x 
Recording 
Screen 
Scraping Scraping 
User 
Events • 
Properties 
Export 
to Excel 
MuhimbiFirstWorkflow 
Expand All Collapse All 
UiPath CoreActivities. ForEach c System. Object > 
varFileArray 
For Each 
ForEach item 
Body 
•n 
= Directory.GetFilesC 
varFiIeArray 
@ Common 
DisplayName 
@ Misc 
TypeArgument 
Values 
a Output 
Index 
Drop Activity Here 
Variables Arguments Imports 
Output Breakpoints Error List 
100% 
O 
For Each 
Object 
varFiIeArray 
The zero-based index 
+ Add To Source Control •

Step 7: Convert the files to PDF.

  • Add the custom ‘Convert To PDF‘ activity in the ‘Sequence‘. (As created in the previous post)
  • Specify the API_Key using your Muhimbi API Key.
  • Set ‘FilePath‘ to ‘item.ToString‘.
  • Set ‘OutFilePath‘ to the variable ‘varDestinationFolder‘.
UiPath Studio 
- MuhimbiProject 
New save save as Debug 
Template File • 
vuhimdiFirstWorkfloz, ' 
MuhimbiFirstWorkfIow 
X cut 
copy 
Paste 
x 
Manage 
Packages 
Reco r d ing 
Scre en 
Scraping 
Data 
Scraping 
Expand All 
100% 
user 
Events • 
Explorer 
Remove Unused 
Variables 
Export 
to Excel 
Publish 
Collapse All 
For Each 
In 
Body 
varFiIeArray 
Properties 
Common 
DisplayName 
@ Input 
API_Key 
FilePath 
E Misc 
P rivate 
E Output 
OutFilePath 
Convert to PDF Activity 
Arguments Imports 
Output Breakpoints Error List 
O 
convert to PDF Activ 
"74f59bdd-a89( 
tem.ToString 
varDestinationF 
+ Add To Source Control •

That’s it- you’re done! Execute(Run File) your workflow from ‘UiPath Studio‘ on your ‘Select Folder‘ and after a short wait, you’ll see PDF files created in the Destination directory.




Subscribe to this blog for the latest updates about UiPath, SharePoint Online, Power Automate (Microsoft Flow), Power Apps and document conversion and manipulation using The PDF Converter.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s