Python 3 PyAutoGUI Script to Automate Image Screenshots and Converting it to PDF Document Using Pillow and img2pdf Modules Full Project For Beginners


Welcome folks today in this blog post we will be automating image screenshots using pyautogui and converting it to pdf documents using pillow and img2pdf modules in python 3.All the full source code of the application is shown below.




Get Started




In order to get started you need to install the below libraries using the pip command as shown below



pip install pyautogui


pip install pillow


pip install img2pdf


After installing this libraries make an file and copy paste the following code



import pyautogui
from PIL import Image

# Taking Screnshot
takeScreenshot = pyautogui.screenshot()

# The path of Screenshot and r' is used for specifying raw string
screenshotPath = r'C:\Users\Pranjal\Desktop\gfgarticle\PDF\screenshot.png'

# Saving the screenshot in the given Path

# Opening image
open_image =
convert_image = open_image.convert('RGB')

# Output Pdf Path
outputpdfPath = r'C:\Users\Pranjal\Desktop\gfgarticle\PDF\output.pdf'

# Saving the pdf

Leave a Reply