code: def create_watermark(f_jpg, pdf_out):
      
      f_pdf = pdf_out
      w_pdf = 20 * cm
      h_pdf = 20 * cm
  
      c = canvas.Canvas(f_pdf, pagesize=(w_pdf, h_pdf))
      c.setFillAlpha(0.5)  # 设置透明度
      c.drawImage(f_jpg, 5 * cm, 5 * cm, 5 * cm, 5 * cm)
docs: 创建图片水印pdf