Split PDF and convert to text file

I am trying to develop a work around to a challenge I have.

The objective of this code is to take any sized pdf, and convert each unique page into a text file using OCR, and deposit all those text files into a folder.

I am stuck on two places:

  1. I am getting a runtime error because of the variable pageCounterString, which I am trying to use to provide the “Range” to the readpdf block.
  2. I don’t know how to save .txt files that I make to a specific location. I need them to go to a specific location so I can go into them and perform scrapes later.

Any help is much appreciated, and thank you in advance.

Sequence1.xaml (7.2 KB)

Apologies, here is the code.

What packages are you using here? I am missing dependencies and can’t figure out what I need to installed. I tried installing the PDF activities pack as well as the Microsoft OCR library, but I am still getting an error that i have missing or invalid activities

I couldnt get everything to load, but i’ll do my best.

#1 I would get rid of the pageCounterString variable. just use pageCounter.ToString as needed, there is no benefit of having the extra variable because currently it isn’t being updated anyways. You are getting the error in #1 because you are providing the literal string “pageCounterString” - you instead should provide a variable so you would simply remove the quotes and have it be pageCounterString - although I personally would just do pageCounter.ToString due to reasons mentioned above.

#2 You are on the right track for this one! At the top of the sequence (outside the loop) you should create a string variable called FolderPath and assign it the directory/folder you want to save the files in. Then in your write text activity the file name property should be: FolderPath + "\page" + pageCounter.ToString + ".txt" This will create a text file for each page named page1, page2, etc in the folder path you specified earlier.