Category "pypdf2"

Odoo15 - ModuleNotFoundError: No module named 'PyPDF2'

I'm new to Odoo. I use pyenv to host odoo and all the dependencies. All under odoo system user, and I was able to start odoo service: ~# systemctl status odoo-1

Merging PDFs on memory and saving in PDF/a format with ghostscript

I try to merge two pdfs with PyPDF2 in memory and save the resulting pdf in the PDF/a format. Convert a Pdf to PDF/a with Ghostscript works, but only with two p

How do I know my file is attached in my PDF using PyPDF2?

I am trying to attach an .exe file into a PDF using PyPDF2. I ran the code below, but my PDF file is still the same size. I don't know if my file was attached o

How to attach mulitple files in PDF?

I have a list of objects: List = ['Doc1.xlsx','Doc2.csv','Doc3.pdf'] and a list of their names: List1 = ['Doc1_name.xlsx','Doc2_name.csv','Doc3_name.pdf']. I ne

How to write the argument of 'fit' in addLink(): PyPDF2

I want to add links to other pages to existing PDF by using PyPDF2. My code works when fit argument is '/Fit', however, I want to use the zoom option. After jum

error: Unable to find trailer dictionary while recovering damaged file

PyPDF2 fail sometimes with decryption of some PDF files, and I am trying do decrypt them with pikepdf but I am getting this error: Unable to find trailer dictio

Fill PDF form values using PyPDF2 multiple pages but getting same and duplicate data on all pages of pdf

I have used this below code. from PyPDF2 import PdfFileWriter, PdfFileReader from PyPDF2.generic import BooleanObject, NameObject, IndirectObject def set_need

Change metadata of pdf file with pypdf2

I want to add a metadata key-value pair to the metadata of a pdf file. I found a several years old answer, but I think this is way to complicated. I guess ther

Merging multiple PDFs at specified pages

I am trying to use Python to merge multiple PDFs at specific pages I want. So for instance, let's say we have 3 pdfs and I want to merge the second one at page

PyPDF2.PdfFileWriter addAttachment not working

Based on https://programtalk.com/python-examples/PyPDF2.PdfFileWriter/, example 2, I try to to add an attachment into a PDF file. Here is my code I am trying to

Reading a pdf from a zipfile

I'm trying to get PyPDF2 to read a small .pdf file that is within a simple zip file. Here's what I've got so far: import PyPDF2,zipfile with zipfile.ZipFile("T

PyPDF2 PdfFileWriter has no attribute stream

I am trying to split a pdf into its pages and save each page as a new pdf. I have tried this method from a previous question with no success and the pypdf2 spli

Detect and crop a box in .pdf or image as individual images

I have a multi-page .pdf (scanned images) containing handwriting I would like to crop and store as new separate images. For example, in the visual below I would

Duplicating PDF with PyPDF2 gives blank pages

I'm using PyPDF2 to alter a PDF document (adding bookmarks). So I need to read in the entire source PDF, and write it out, keeping as much of the data intact as

PyPDF2 extract empty Text

I am using PyPDF2 for extract text from pdf. All examples which I found in the google look like my code: import PyPDF2 reader = PyPDF2.PdfFileReader("test2.pd

convert from pdf to text: lines and words are broken

I want to convert a pdf file to text by PyPDF2 but converted text looks differents from PDF file. Specifically, one line in PDF is broken into multiple lines in

Add a bookmark to a PDF with PyPDF2

I'm trying to add a bookmark to a PDF using PyPDF2. I run the following with no problems. But a bookmark is never created. Any thoughts on what I'm doing wrong.

Read all bookmarks from a PDF document and create a dictionary with PageNumber and Title of the bookmark

I a trying to read a PDF document using Python with PyPDF2 package. The objective is to read all the bookmarks in the pdf and construct a dictionary with page n

Why does PyPDF2.PdfFileWriter forget changes I made to a document?

I am trying to modify text in a PDF file. The text can be in an object of type Tj or BDC. I find the correct objects and if I read them directly after changing

Edit text in PDF with python

I have a pdf file and I need to edit some text/values in the pdf. For example, in the pdfs that I have "BIRTHDAY DD/MM/YYYY" is always "N/A". I want to change i