Skip to content

Addition of PDF merging #60

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added PDF merge/Merged_result.pdf
Binary file not shown.
21 changes: 21 additions & 0 deletions PDF merge/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Merging Multiple PDFs using Python

You Need to open your favourite Editor , create folder name 'PDFmerge' inside create file 'mergePDF.py' copy and paste code from mergePDF.py file this repo.

Open Terminal type

```py
pip install PyPDF2

```

You need to keep PDF files that you want to merge in Python’s working directory.Of course, you can change the directory using Python code. For simplicity of code, I am placing the PDF files on the working directory.


```py
python3 mergePDF.py

```


After Runnig this Code you will get output as the Merged pdf file.
13 changes: 13 additions & 0 deletions PDF merge/mergePDF.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
from PyPDF2 import PdfFileMerger

# array of PDFs which need to merge
pdfs = ['repo.pdf', 'python.pdf']

merger = PdfFileMerger(strict=False)

for pdf in pdfs:
merger.append(pdf)

merger.write("Merged_result.pdf")
print('PDF Merged Wohh !!')
merger.close()
Binary file added PDF merge/python.pdf
Binary file not shown.
Binary file added PDF merge/repo.pdf
Binary file not shown.
1 change: 1 addition & 0 deletions PDF merge/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
PyPDF2==1.26.0