Skip to content

Commit 8c25220

Browse files
committed
PDF Merger
1 parent 6fd020f commit 8c25220

File tree

6 files changed

+35
-0
lines changed

6 files changed

+35
-0
lines changed

PDF merge/Merged_result.pdf

1.1 MB
Binary file not shown.

PDF merge/README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
### Merging Multiple PDFs using Python
2+
3+
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.
4+
5+
Open Terminal type
6+
7+
```py
8+
pip install PyPDF2
9+
10+
```
11+
12+
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.
13+
14+
15+
```py
16+
python3 mergePDF.py
17+
18+
```
19+
20+
21+
After Runnig this Code you will get output as the Merged pdf file.

PDF merge/mergePDF.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from PyPDF2 import PdfFileMerger
2+
3+
# array of PDFs which need to merge
4+
pdfs = ['repo.pdf', 'python.pdf']
5+
6+
merger = PdfFileMerger(strict=False)
7+
8+
for pdf in pdfs:
9+
merger.append(pdf)
10+
11+
merger.write("Merged_result.pdf")
12+
print('PDF Merged Wohh !!')
13+
merger.close()

PDF merge/python.pdf

667 KB
Binary file not shown.

PDF merge/repo.pdf

449 KB
Binary file not shown.

PDF merge/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
PyPDF2 ==1.26.0

0 commit comments

Comments
 (0)