Difference between revisions of "Python: Read PDF"

From OnnoWiki
Jump to navigation Jump to search
(Created page with " ==Pranala Menarik== * Python")
 
Line 1: Line 1:
 +
 +
 +
 +
#install pyDF2
 +
pip install PyPDF2
 +
 +
# importing all the required modules
 +
import PyPDF2
 +
 +
# creating an object
 +
file = open('example.pdf', 'rb')
 +
 +
# creating a pdf reader object
 +
fileReader = PyPDF2.PdfFileReader(file)
 +
 +
# print the number of pages in pdf file
 +
print(fileReader.numPages)
  
  

Revision as of 16:02, 28 October 2018


  1. install pyDF2

pip install PyPDF2

  1. importing all the required modules

import PyPDF2

  1. creating an object

file = open('example.pdf', 'rb')

  1. creating a pdf reader object

fileReader = PyPDF2.PdfFileReader(file)

  1. print the number of pages in pdf file

print(fileReader.numPages)


Pranala Menarik