In the above code, you’ll need to make sure to specify: Pdf_path = r'path where the pdf will be stored\new file name.pdf' Screenshot_path = r'path to save screenshot\file name.png' You can use the following template to assist you in taking the screenshot and converting it to PDF using Python: import pyautogui Step 2: Take the screenshot and then convert it to PDF Next, install the Pillow (PIL) package using this command: pip install Pillow Note that depending on your version of pip, you may run into an issue with the installation of pyautogui.
If you haven’t already done so, install the pyautogui package using the command below: pip install pyautogui Steps to take a screenshot and then convert it to PDF using Python Step 1: Install the relevant packages To accomplish this goal you’ll need to use the following packages: In this tutorial, you’ll see the complete steps to take a screenshot and then convert it to PDF using Python.