Use AI Chat to automatically take screenshots of e-books and save them as pdf files

If you want to download e-books, there are only two types of methods. One is to crack it from the inside. Usually some geeks crack the software into a free version, but the risk is also high. The other is to crack it from the outside, which is to take screenshots and save them, and then put all the pictures into a pdf file.

If you want to take a screenshot of the entire e-book and save it, the action of taking the screenshot is extremely repetitive. Computers are not just good at doing repetitive actions, so just let the computer:































































screenshot









save









Next page







Is it over?









Save as PDF







Keep repeating this action until the conditions are met and save it as a PDF file.
Once the theory is established, it can be put into practice
As a novice who doesn’t have strong development skills or coding skills, my hair will fall out if I just rub it with my hands. AI Chat such as ChatGPT is very popular recently, and it is very intelligent and can answer most of our questions. I have also been using Baidu’s Wen Xin Yi Yan recently, which is very easy to use and greatly reduces my search time. So that the content I want to practice later is also assisted by Wen Xin Yi Yan.

  1. Since we need to use a computer to operate, we need to cast the content on the mobile phone or tablet.
    Screen projection tools on the market generally require VIP to cast the screen, which obviously does not suit my prostitute personality. Search through Wen Xinyiyan: Use open source tools to project the mobile phone screen to the computer through the data cable (The way you ask questions is really important, otherwise I will recommend you some screencasting software that requires payment.) Next, I will ask AI questions to realize the function of automatically taking screenshots of e-books and saving them as PDF files. Since AI answers questions, asking the same question at different times and in different scenarios will yield different answers

    So I introduced scrcpy to me. As an author who uses love to generate electricity, I will definitely not hide such a useful tool. It is difficult to find the answer by asking questions. Here is the link: scrcpy-Mobile Screen Mirroring Go to your computer <–Here are tutorials on how to download and use scrcpy

  2. How to use python to control the keyboard and mouse. If you don’t know, you can ask AI

import pyautogui
  
# Move the mouse to the (100, 100) coordinates of the screen
pyautogui.moveTo(100, 100, duration=0.25)
  
# Click the left mouse button
pyautogui.click()
  
# Enter text
pyautogui.write('Hello, world!', interval=0.25)
  
# Press the "Enter" key on the keyboard
pyautogui.press('enter')

Now that we have found the pyautogui library we need to use, since this library can control the keyboard and mouse, let’s ask if the pyautogui library can take screenshots.

import pyautogui
  
# Capture the screen and save it as an image file
screenshot = pyautogui.screenshot()
screenshot.save('screenshot.png')

import pyautogui
  
# Take a screenshot of the 1000x1000 area in the center of the screen and save it as a PNG format file
screenshot = pyautogui.screenshot(region=(0, 0, 1000, 1000))
screenshot.save('screenshot.png')
  1. If you want to take a screenshot, you need to specify the area to take the screenshot, and the extra parts are quite redundant. We don’t know how much we need to crop, unless we can locate the mouse position, so let’s ask the AI
import pyautogui
  
# Get the current position of the mouse
mouse_position = pyautogui.position()
  
print("Current mouse position: ({0}, {1})".format(mouse_position[0], mouse_position[1]))
  1. We have finished taking screenshots and saving them. According to the process, we need to turn pages forward and backward by pressing the left and right keys, so let’s ask the AI

    In this way we can realize the page turning function.
    Then keep repeating this operation until the screenshot is completed
  2. How to splice pictures into PDF files
from PIL import Image
  
#Open image file
image = Image.open('image.jpg')
  
# Save the image as a PDF file
image.save('output.pdf')

from PIL import Image
  
# Picture folder path
image_folder = r'F:\pdfscreenshot\inputscreenshot'
# Get the file names of all pictures in the picture folder
image_files = [os.path.join(image_folder, f) for f in os.listdir(image_folder) if f.endswith('.jpg') or f.endswith('.png')]
  
# Create a new blank image with the same size as the first image
images = [Image.open(file) for file in image_files]
  
# Create a new PDF file and add images to it
images[0].save('output.pdf', 'PDF', save_all=True, append_images=images[1:])
  1. To sum up, AI Chat can greatly shorten our search time and provide us with more ideas, but it cannot replace us in completing complex things. This is more like building a machine. AI Chat cannot build us a machine that meets our needs. It can only provide us with tools and parts, and then we need to design and assemble it ourselves.