""" author:少校 create Time:2025/2/26 16:15 越努力越幸运 """ from os import write from PyPDF2 import PdfReader,PdfWriter #1.准备需要添加水印的page和水印对应的page reader1 = PdfReader("files/千锋培训班学员手册.pdf") page1 =reader1.pages[0] water = PdfReader("files/water.pdf").pages[0] #2.准备空的PDF文件 hebing = PdfWriter() #3.给指定页添加水印(需要将两个页进行合并) page1.merge_page(water) #4.将合并后的页添加到新文件中 hebing.add_page(page1) hebing.write("files/水印1页.pdf") #============================给所有页添加水印================== all = PdfWriter() for x in reader1.pages: x.merge_page(water) all.add_page(x) all.write("files/水印all页.pdf")
03.PDF批量添加水印
本节613字2025-02-27 19:19:41