创建图片水印pdf

def create_watermark(f_jpg, pdf_out):
    """创建图片水印pdf
    """
    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)