Convert images (PNG, JPG, etc.) to PDF easily with Python!
-
Install the required package:
pip install img2pdf
Run this command in your terminal or command line (also works in Jupyter Notebook).
-
Run the script:
python Script.py
- PDF Created Successfully!
You’ll see your converted PDF in your specified directory.
-
Always use image files with extensions like
.png,.jpg, etc. -
Specify the full path for your image and PDF files:
- Example for image path:
img = "C:\\Users\\Strendev\\Strendev.png"
- Example for PDF output path:
pdf = "C:\\Users\\Strendev\\Strendev.pdf"
- Use double backslashes (
\\) in Windows paths to avoid errors.
- Example for image path:
-
You can name your PDF file anything you like (e.g.,
username.pdf).
Feel free to update or add more details as needed!
