Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to loop through pages of pdf using python

import PyPDF2
import re

for k in range(1,100):
    # open the pdf file
    object = PyPDF2.PdfFileReader("C:/my_path/file%s.pdf"%(k))

    # get number of pages
    NumPages = object.getNumPages()

    # define keyterms
    String = "New York State Real Property Law"

    # extract text and do the search
    for i in range(0, NumPages):
        PageObj = object.getPage(i)
        print("this is page " + str(i)) 
        Text = PageObj.extractText() 
        # print(Text)
        ResSearch = re.search(String, Text)
        print(ResSearch)
Comment

PREVIOUS NEXT
Code Example
Python :: piecewise linear regression python 
Python :: python int binary 
Python :: keras 
Python :: switch between frames in tkinter 
Python :: group by month and day pandas 
Python :: how to remove element from nested list in python 
Python :: cmd to get ip address python 
Python :: gaierror at /members/register [Errno 11001] getaddrinfo failed 
Python :: flask api with parameter 
Python :: TypeError: Direct assignment to the forward side of a many-to-many set is prohibited. Use .set() instead 
Python :: with open 
Python :: how to make a variable global in python 
Python :: self in python 
Python :: upload file to s3 python 
Python :: python byte like to string 
Python :: python track time 
Python :: django abstractuser 
Python :: all possible combinations in python 
Python :: python anytree 
Python :: get coordinates in xarray 
Python :: What will be the output of the following program? 
Python :: if statement in python 
Python :: math module in python 
Python :: __lt__ 
Python :: Group by a column, count sum of other columns 
Python :: urllib.error.HTTPError: HTTP Error 404: Not Found 
Python :: cv2 frame size 
Python :: split string python 
Python :: python argparser flags 
Python :: rename all columns 
ADD CONTENT
Topic
Content
Source link
Name
3+8 =