Split PDF > input Name from PDF into file name.pdf

I have created a bot that will read the files in a PDF then split all the files into individual PDF files. That works well, it names the file with a number at the end of the name file. It creates 365 files. The ask is if this can create separate files with the doctors name that appear in the PDF. For example Abdelaal, Ihab DO.pdf not the file name PDF Export with bookmarks 2021-12-07 VBI(1).pdf and so on.
I used read PDF text and output the first files data. (image 1)

Here is the bot screen.

You have few option but it’s depends from content of PDF file.
But based on the output which you showed us I think that you can split text by new line. Of course if the name of the doctors appear always in the first row :slight_smile:
So, for example:
array = extractPDFVariable.Split({vbLf},StringSplitOptions.RemoveEmptyEntries)

The name of each doctor appears in the same location in the PDF

In the first assign you have a variable for str but what is in the = to area? It gets cut off

str it is your extracted text from pdf.
Array is the splitted extracted text by new line. It means every new line is the new array element.
If you will take first item of the array you will get name of the doctor.
Of course you can delete extra characters like comma (,) etc. to use this name for file name but it will be only string manipulation.

Please take example of xaml file:
BlankProcess13.zip (67.6 KB)
I hope it will be more clear now :slight_smile:

Hit an error

Because ‘files/’ is folder inside my project specially to show you example. So, probably you don’t have this folder in your project.
You can create or change the path.
But I also noticed that it downloaded some additional data for the name.
To do this right way, you should share pdf content as a .txt file.


Thank you for the help

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