Extract Text From All the Pages of a PDF Document in Python

Contents
[ ]

To extract TextrFrom All the Pages Pdf document using Aspose.PDF Java for Python, simply invoke ExtractTextFromAllPages module.

# Open the target document
pdf=self.Document()
pdf=self.dataDir + 'input1.pdf'

text_absorber=self.TextAbsorber()

pdf.getPages().accept(text_absorber)

extracted_text=text_absorber.getText()

writer=self.FileWriter(self.File(self.dataDir + 'extracted_text.out.txt'))
writer.write(extracted_text)
writer.close()

print "Text extracted successfully. Check output file."

Download Running Code

Download Extract Text From All the Pages (Aspose.PDF) from any of the below mentioned social coding sites: