Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Merging pdfs with PyPDF2
#1
I have a Human Resources document, a lot of pages, more than 100. I need them as a pdf.

I can batch scan to pdf with my little Epson DS-510, great little scanner.

I can first scan all the odd pages, 1,5,7,9 ... to PDF, then the even pages 2,4,6, ... to PDF

Each page is just an image, not text.

I can get text with:

print(pytesseract.image_to_string(Image.open('page1.jpg'), lang='chi_sim'))
I tried this, it works well. I'll have to figure out how to do that with each page of a PDF, but, first I need to merge the 2 PDFs

I have the module PyPDF2 so I think I should be able to merge the oddpages.pdf and the evenpages.pdf to allpages.pdf.

I think I need a file allpages.pdf, then append page1 of oddpages.pdf to allpages.pdf, then page1 of evenpages.pdf to allpages.pdf, page2 of oddpages.pdf to allpages.pdf, page2 of evenpages.pdf to allpages.pdf and so on.

However, I have never done this before, so I would appreciate any tips!

I looked here but it is not very clear to me as a non-geek.

I also looked here. There are 3 examples of merger, but I think they would just append the whole pdf to another pdf.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  PyPDF2 deprecation problem gowb0w 5 3,531 Sep-21-2023, 12:38 PM
Last Post: Pedroski55
  ModuleNotFoundError: No module named 'PyPDF2' Benitta2525 1 1,393 Aug-07-2023, 05:32 AM
Last Post: DPaul
  Comparing PDFs CaseCRS 5 1,145 Apr-01-2023, 05:46 AM
Last Post: DPaul
  Pypdf2 will not find text standenman 2 878 Feb-03-2023, 10:52 PM
Last Post: standenman
  pyPDF2 PDFMerger close pensding file japo85 2 2,340 Jul-28-2022, 09:49 AM
Last Post: japo85
  PyPDF2 processing problem Pavel_47 6 9,645 May-04-2021, 06:58 AM
Last Post: chaitanya
  download pubmed PDFs using pubmed2pdf in python Wooki 8 5,369 Oct-19-2020, 03:06 PM
Last Post: jefsummers
  How to compare two PDFs for differences Normanie 2 2,353 Jul-30-2020, 07:31 AM
Last Post: millpond
  Concatenate multiple PDFs using python gmehta1996 0 2,085 Mar-29-2020, 09:48 PM
Last Post: gmehta1996
  Problem with installing PyPDF2 Pavel_47 2 5,946 Nov-10-2019, 02:58 PM
Last Post: Pavel_47

Forum Jump:

User Panel Messages

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