Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PyPDF2 or indentation issue
#3
Also indentation always 4-space,never single \ that way in filename Windows.
You open file 2 times in first code.
from PyPDF2 import PdfFileReader, PdfFileWriter
import os

directory = os.listdir("E:/pdf/1")
for file in directory:
    if file.endswith(".pdf"):
        pfile = "E:/pdf/1/" + file
        pdfFile = PdfFileReader(open(pfile, 'rb'))
        page = pdfFile.getPage(0)
        print(page.extractText())
Reply


Messages In This Thread
PyPDF2 or indentation issue - by siten0308 - Apr-20-2018, 06:50 PM
RE: PyPDF2 or indentation issue - by Larz60+ - Apr-20-2018, 07:37 PM
RE: PyPDF2 or indentation issue - by snippsat - Apr-20-2018, 07:54 PM
RE: PyPDF2 or indentation issue - by siten0308 - Apr-20-2018, 09:35 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  PyPDF2 deprecation problem gowb0w 5 5,365 Sep-21-2023, 12:38 PM
Last Post: Pedroski55
  ModuleNotFoundError: No module named 'PyPDF2' Benitta2525 1 1,905 Aug-07-2023, 05:32 AM
Last Post: DPaul
  Pypdf2 will not find text standenman 2 1,080 Feb-03-2023, 10:52 PM
Last Post: standenman
  pyPDF2 PDFMerger close pensding file japo85 2 2,639 Jul-28-2022, 09:49 AM
Last Post: japo85
  PyPDF2 processing problem Pavel_47 6 10,089 May-04-2021, 06:58 AM
Last Post: chaitanya
Bug Python Shell 3.9.0 - Issue with indentation Earis 17 7,202 Oct-31-2020, 07:00 AM
Last Post: Earis
  Problem with installing PyPDF2 Pavel_47 2 6,216 Nov-10-2019, 02:58 PM
Last Post: Pavel_47
  looping and indentation issue ameydiwanji 3 2,584 Jul-01-2019, 10:53 AM
Last Post: perfringo
  pyPDF2 nautilus columns modification AJBek 1 3,004 Jun-07-2019, 04:17 PM
Last Post: micseydel
  Using Pypdf2 write a string to a pdf file Pedroski55 6 20,990 Apr-11-2019, 11:10 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020