Split PDF to save 2 pages at a time

I am trying to take a PDF with multiple pages and extract every two pages into separate PDF files. Is this even possible in StudioX? If so, how do I complete this process. Most of the examples I see are in Studio and I do not have access to that version.

Hi @steveo0224

Install the UiPath.PDF.Activites to use the Pdf activities from Manage Packages.

Check the below steps for better understanding,
→ Use the Get Pdf Page Count activity to know the page count of the pdf and store in a variable called PageCount.
→ Then use two Set variable values activity to create two variables and assign values

- StartRange = 1
- EndRange = 2

→ Then use for each activity for iteration and give the below expression in List of items field,

Enumerable.Range(0,pagecount)

→ Inside For each insert the If condition to check the below condition,

- Condition -> pagecount>=EndRange

→ Inside then block insert the Extract Pdf range activity and give the input pdf file path and output file path where you want to save split files. In Output File Path for chaning names of file I given as below,

<[Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)]>\Downloads\"+<[StartRange.ToString]>.toString+".pdf

→ After that used two set variable value activity to increment the StartRange and EndRange

- StartRange = StartRange+2
- EndRange = EndRange+2

→ In else block insert the break activity to break the loop after if condition not met.

Check the below workflow for better understanding and edit as your requirements,
Main.xaml (14.7 KB)

Hope it helps!!

This is perfect. Thank you!

1 Like

It’s my pleasure… @steveo0224

Happy Automation!!

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