[1039] In python, open a PDF file and maximize it
The implementation is as follows:
import win32gui, win32con, os, time
# Pdf report file path
file_path = os.path.join(pdf_folder, pdf_name)
# Open and maximize the PDF file
os.startfile(file_path)
# Wait as long as needed for the file to open, this value can be adjusted as needed
time.sleep(2)
# Now maximize the current foreground window (should be the one we care about at this point)
hwnd = win32gui.GetForegroundWindow()
win32gui.ShowWindow(hwnd, win32con.SW_MAXIMIZE)
time.sleep(0.5)
浙公网安备 33010602011771号