Now let’s try reading the file “Btech_job.pdf” having the following 2 pages.ĭownload this PDF here # import the module Once it has been successfully done writing import PyPDF2 will not throw error. The module name is case sensitive so make sure only letter ‘y’ is in the lower case and everything rest in the upper case. Start by installing PyPDF2 from the command line using the following command. There are other 3rd party libraries to read media from PDF like ‘Tabula-py’ for tables, ‘pyTesseract’ for extracting images and so on but here our main focus is reading text in the form of string. But the problem is that the inbuilt function doesn’t support pdf file formats.īut don’t worry there are several 3rd party python libraries to work with pdf files:īefore proceeding please note that “PyPDF2” cannot extract images, charts, tables or other media from PDF documents. Likewise reading the “txt” file in python is easy as python has inbuilt library methods to do so. Python being a high-level language is capable of doing almost everything to automate a task. So reading a pdf file using python language would be more interesting. PDF is one of the widely used file formats for sharing data digitally.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2022
Categories |