How to read a pdf one page at a time?

I need to read the contents of a pdf one page at a time and feed it on Chatgpt. Now I need to fetch the results and store in a word, with heading Page followed by the response of chatgpt. How do I do this for each page? Currently I’m using do-while and read pdf text

*with heading as page number


Welcome to the community

Do while and read pdf is what you would do…

And for writing use append text activity in word activities to write responses to word



you can use this basic structure

Check this video
Extract pages from a PDF file - RPA Component | UiPath Marketplace | Overview

Extract selected page(s) from a PDF file

You can read the entire page and then segment each page into 1 value
it will be an array of String
From here you can use it one after another
When reading pdf, you can extract pages or have a regex way to get each page out


You can try this

  • Assign: currentPageNumber = 1
  • Do While: Condition is currentPageNumber <= totalPages
    • Read PDF Text: Range is currentPageNumber.ToString
    • HTTP Request (if using API) or Your Method of Sending to ChatGPT: Send the extracted text and receive the response.
    • Word Application Scope: Specify the file path for the Word document.
      • If: Condition is currentPageNumber = 1
        • Add Word Document activity (if it doesn’t exist)
      • Add Heading: Text is "Page " + currentPageNumber.ToString
      • Append Text: Text is the response from ChatGPT.
    • Assign: currentPageNumber = currentPageNumber + 1
  • End Do While

Hope this helps