Skip to content

Commit 4f4fd40

Browse files
JaswantTejatechyminati
authored andcommitted
Create img_to_pdf.py
This script will convert Image to The PDF File
1 parent 88461b1 commit 4f4fd40

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

‎img_to_pdf.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import os
2+
from fpdf import FPDF
3+
4+
# Place Your Images In The Images Folder.
5+
def converter():
6+
img_files = os.listdir('images/')
7+
print('files to be converted: ', img_files)
8+
pdf = FPDF()
9+
for image in img_files:
10+
pdf.add_page()
11+
pdf.image('images/' + image)
12+
pdf.output('converted.pdf', 'F')
13+
14+
15+
if __name__ == '__main__':
16+
converter()

0 commit comments

Comments
 (0)