![]() ![]() PdfFileObj = open('C:/Google Drive/Ward 29/data/55 HARRISON GARDEN.pdf',Ĭan anyone help me figure how I can fix it to read that pdf, “55 Harrison Garden. Harrison gdn file! I need to figure out why However, print(page_content) does return null if I use another PDF file, “55 HARRISON GARDEN.pdf” which I actually need to extract some information from: In: This code works for the ndvi file, but returns empty string for the Print(page_content) closing the pdf file object Though PyPDF2 doesn’t contain any specific method to read remote files, you can use Python’s urllib.request module to first read the remote file in bytes and then pass the file in the bytes format to PdfFileReader() method. ![]() Number_of_pages =pdfReader.getNumPages() creating a page object You can also use PyPDF2 to read remote PDF files, like those saved on a website. PdfReader = PyPDF2.PdfFileReader(pdfFileObj, strict=False) getting the number of pages in pdf file PdfFileObj = open('C:/Google Drive/Ward 29/data/ndvi.pdf', 'rb') creating a pdf reader object ![]() To do so, I am using this code and it works fine returning the PDF as a continuous text as string variable: In: This is my pdf fie and this is my code: import PyPDF2 openedpdf PyPDF2.PdfFileReader('test.pdf', 'rb') popenedpdf.getPage(0) ptext p.extractText() extract data line by line Plinesptext. I am using Python 3.6.1 on Windows 8.1 and I want to extract certain texts from a group of PDF files. I want to extract text from pdf file using Python and PYPDF package. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
February 2023
Categories |