pypdf

Why do these buttons open the same file regardless of which on I select?

Why do these buttons open the same file regardless of which on I select? Question: I’m making a pdf ‘date checker’ in Python which tells me if every page of the pdf has tomorrows date at the top (for checking newspapers as part of my job). So far so good until I attempted to put …

Total answers: 1

Python Script for counting the number of Pages for each PDF in a directory

Python Script for counting the number of Pages for each PDF in a directory Question: I am new to Python, and I am trying to create a script that will list all the PDF’s in a directory and the number of pages in each of the files. I have used the recommended code from this …

Total answers: 3

pypdf gives output with incorrect PDF format

pypdf gives output with incorrect PDF format Question: I am using the following code to resize pages in a PDF: from pypdf import PdfReader, PdfWriter, Transformation, PageObject, PaperSize from pypdf.generic import RectangleObject reader = PdfReader("input.pdf") writer = PdfWriter() for page in reader.pages: A4_w = PaperSize.A4.width A4_h = PaperSize.A4.height # resize page to fit *inside* A4 …

Total answers: 2

Creating and then modifying pdf file in python

Creating and then modifying pdf file in python Question: I am writing some code that merges some pdfs from their file paths and then writes some text on each page of the merged document. My problem is this: I can do both things separately – merge pdfs and write text to a pdf – I …

Total answers: 1

Read PDF in base64 format with a PDF library in Python

Read PDF in base64 format with a PDF library in Python Question: I have a base64 string and I need to read it with a Python library. I can do that with the following steps: Decode the PDF in base64 Save it into a new file Read it with libraries like PyPDF2 But since I …

Total answers: 1

PyPDF2 fill Arabic is not visible while English is fine

PyPDF2 fill Arabic is not visible while English is fine Question: I am trying to fill a PDF with Arabic and English. English is fine but Arabic is not visible after writing. It’s showing on click. I am translating the English into Arabic text using Google API. I have also tried appearance functionality, fillpdf, PyPDF2 …

Total answers: 1

Camelot: DeprecationError: PdfFileReader is deprecated

Camelot: DeprecationError: PdfFileReader is deprecated Question: I have been using camelot for our project, but since 2 days I got following errorMessage. When trying to run following code snippet: import camelot tables = camelot.read_pdf(‘C:\Users\user\Downloads\foo.pdf’, pages=’1′) I get this error: DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead. I checked this …

Total answers: 2

ImportError: cannot import name 'PdfReader' from 'PyPDF2'

ImportError: cannot import name 'PdfReader' from 'PyPDF2' Question: I installed the PyPDF2 package using pip and got the following message after the installation: !pip install PyPDF2 Collecting PyPDF2 Downloading PyPDF2-2.11.1-py3-none-any.whl (220 kB) ————————————– 220.4/220.4 kB 2.7 MB/s eta 0:00:00 Requirement already satisfied: typing-extensions>=3.10.0.0 in c:usersdellappdatalocalprogramspythonpython37libsite-packages (from PyPDF2) (3.10.0.2) Installing collected packages: PyPDF2 Successfully installed PyPDF2-2.11.1 …

Total answers: 1

How can I merge mutiple pdf-files to one?

How can I merge mutiple pdf-files to one? Question: from tkinter import filedialog as fd import tkinter as tk from PyPDF2 import PdfFileReader, PdfFileWriter, PdfFileMerger import os mother = tk.Tk() base_pdf = fd.askopenfilename(filetypes=[(‘PDF files’, ‘.pdf’)], title=’Wählen Sie bitte die Basis-PDF-Datei aus’) part_pdf = fd.askopenfilenames(title=’Wählen Sie bitte die zugehörigen PDF-Dateien aus’) pdfs = [base_pdf, part_pdf] x …

Total answers: 1

No module named 'PyPDF2._codecs', even after already installed

No module named 'PyPDF2._codecs', even after already installed Question: I have installed PyPDF2==2.3.0, but I still get the error below when I import PyPDF2. The error message is: ModuleNotFoundError: No module named ‘PyPDF2._codecs’ Asked By: Guy || Source Answers: This issue was only present in the PyPI distribution of PyPDF2==2.3.0 for a couple of hours. …

Total answers: 2