Created
September 10, 2022 18:19
-
-
Save samirsaci/44478c5f1cff95b3a99eb9a7c77a9358 to your computer and use it in GitHub Desktop.
Productivity
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import PyPDF2 | |
| # Open the report | |
| pdfFileObj = open('example.pdf', 'rb') | |
| # Launch pdf reader object | |
| pdfReader = PyPDF2.PdfFileReader(pdfFileObj) | |
| # number of pages in pdf | |
| n_pages = pdfReader.numPages) | |
| Texts = [] | |
| for p in range(n_pages): | |
| # Open the page | |
| pageObj = pdfReader.getPage(p) | |
| # Add the text in your list | |
| Texts.append(pageObj.extractText()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment