拖拽你的WORD到这里 或者

转换类型

Word 转图片PDF

是什么:将 Word 文档转换为每页都是图片的 PDF 文件。

为什么:防止内容被修改,保持格式一致性。


Python 示例

python

from pdf2image import convert_from_path
import subprocess
import os

def word_to_image_pdf(docx_path, output_pdf="output.pdf"):
    """Word 转图片PDF"""

    # 1. Word 转 PDF
    subprocess.run([
        'libreoffice', '--headless', '--convert-to', 'pdf',
        docx_path
    ], capture_output=True)

    # 2. PDF 转图片
    pdf_path = docx_path.replace('.docx', '.pdf')
    images = convert_from_path(pdf_path, dpi=200)

    # 3. 图片保存为PDF
    images[0].save(
        output_pdf, "PDF",
        resolution=100.0,
        save_all=True,
        append_images=images[1:]
    )

    # 清理临时文件
    os.remove(pdf_path)
    print(f"转换完成: {output_pdf}")

# 使用示例
word_to_image_pdf("document.docx", "image_pdf.pdf")

安装依赖

bash

pip install pdf2image pillow
# 系统还需安装:LibreOffice 和 poppler-utils

一句话总结:将 Word 文档先转 PDF,再将每页转为图片,最后合并为图片PDF,完美保持原始格式且防修改。