Convert pages to text and write to a file.
convertToTextFile([in] int firstPage, [in] int lastPage, [in] BSTR textFileName)
This function converts the specified range of pages (firstPage through lastPage) to text, and writes the text to a file on disk (textFileName).

If lastPage is -1, this function will convert up to the last page in the PDF file. (See also numPages.)

convertToTextFile throws an error if the file could not be created or if text extraction is prohibited by this PDF file.

This function is identical to convertToTextString except that it extracts to a file on disk rather than to a string in memory.

See the "Setting parameters" section in the function list for settings that affect text extraction.

pdf.convertToTextFile 1, n, "path\to\file.txt"