Read pdf file from downloads directory with python using pdfrw library

495 Views Asked by At

I want to manipulate pdf file using PDFRW library, so when I try to get the source of the pdf file I can't get the file and read it so please help.

  from pdfrw import pdfreader
  import os
  import pathlib

  pdf_file = pdfreader('C:\\Users/4488\\Downloads\\Life-of-Muhammad.pdf')


  print(pdf_file.Keys())


        this is the error that I am getting

        Traceback (most recent call last):
        File "c:\Users\4488\desktop\Xhamar-Project\xhamar.py", line 8, in 
        <module>
        get_file = pdfreader(pdf_file)
        TypeError: 'module' object is not callable
1

There are 1 best solutions below

0
On

I know... I'm a bit late, but in case you didn't figured it out:

Try to use pdfrw.PdfReader() instead of pdfrw.pdfreader()

Have a nice day