Skip to main content

��������������������� Python ��������� PDF ��������������� PowerPoint ������������

Project description

pdf2ppt

Python Version License

��������������������� Python ��������� PDF ��������������������������������������������� PowerPoint ������������������

��� ������

  • ���� ������������ - ������������������ PDF ��� PPT ���������
  • ���� ������������ - ������������ PDF ��������������� PPT ������
  • ���� ������������ - ��������������� DPI��������������� 600
  • ���� ������������ - ������������������ PDF ������
  • ������ ������������ - ���������������������������������
  • ���� ��������� - ������ Windows���macOS���Linux

���� ������

���������������������������

# ������������������������
cd pdf2ppt_package

# ���������������������������������
pip install -e .

# ���������������
pip install .

������������

Windows ������������������������ poppler:

  1. ������: https://github.com/oschwartz10612/poppler-windows/releases
  2. ��������������������������� C:\poppler���
  3. ������ C:\poppler\Library\bin ��������������������� PATH

macOS ������:

brew install poppler

Linux ������:

# Ubuntu/Debian
sudo apt-get install poppler-utils

# Fedora/CentOS
sudo yum install poppler-utils

���� ������������

������������

from pdf2ppt import pdf_to_ppt

# ��������������������������� PDF ��� PPT
pdf_to_ppt("������.pdf")
# ������: ������.pptx

# ���������������������������������
pdf_to_ppt("������.pdf", "������PPT.pptx", dpi=300)

������������

from pdf2ppt import PDF2PPT

# ���������������
converter = PDF2PPT("������.pdf", dpi=300, crop_whitespace=True)

# ������ PDF ���������
images = converter.convert_pdf_to_images()
print(f"������������ {len(images)} ���")

# ������ PPT������������������������
converter.create_ppt()

# ��������������� 16:9 ������
converter.create_ppt(width=10, height=5.625)

������������

from pdf2ppt import batch_convert

# ������������������ PDF
batch_convert(["������1.pdf", "������2.pdf", "������3.pdf"], dpi=300)

���������������

���������������������������������������������

# ������������
pdf2ppt ������.pdf

# ������������������
pdf2ppt ������.pdf ������.pptx

# ���������������
pdf2ppt ������.pdf ������.pptx 200

���� API ������

pdf_to_ppt(pdf_path, output_ppt=None, dpi=300, crop_whitespace=True)

������������������������ PDF ��������� PPT

������:

  • pdf_path (str): PDF ������������
  • output_ppt (str, ������): ������ PPT ������������������ PDF ������
  • dpi (int, ������): ������������������������ 300
  • crop_whitespace (bool, ������): ��������������������������� True

������: str - ��������� PPT ������������


PDF2PPT ���

���������

converter = PDF2PPT(
    pdf_path="������.pdf",
    output_ppt="������.pptx",  # ������
    dpi=300,                  # ������
    crop_whitespace=True      # ������
)

������

convert_pdf_to_images() -> list

  • ��� PDF ���������������������
  • ������: PIL Image ������������

create_ppt(width=10, height=None, auto_fit=True) -> str

  • ������ PPT ���������������
  • ������:
    • width (float): PPT ������������������
    • height (float): PPT ���������������������None ���������������
    • auto_fit (bool): ������������������������
  • ������: ��������� PPT ������������

convert() -> str

  • ���������������PDF ��� PPT
  • ������: ��������� PPT ������������

batch_convert(pdf_files, dpi=300, crop_whitespace=True)

������������������ PDF ������

������:

  • pdf_files (list): PDF ������������������
  • dpi (int, ������): ������������������������ 300
  • crop_whitespace (bool, ������): ��������������������������� True

������ ������������

DPI ������

DPI ������������ ������������ ���������
150 ������/������ ��� ������
200 ������������ ������ ������
300 ������������������������ ������ ������
600 ������������ ������ ������

PPT ������������

������ ������ x ������������������ ������
16:9������������ 10 x 5.625 ������������
4:3 10 x 7.5 ������������
A4 8.27 x 11.69 ���������

���� ������������

������ 1: ������������

from pdf2ppt import pdf_to_ppt

# ���������������300 DPI������������������������
pdf_to_ppt("������.pdf")

������ 2: ���������������

from pdf2ppt import PDF2PPT

# ���������������
converter = PDF2PPT(
    pdf_path="������.pdf",
    output_ppt="������������.pptx",
    dpi=300,
    crop_whitespace=False  # ���������������
)

# ������
converter.convert_pdf_to_images()
converter.create_ppt(width=10, height=5.625)  # 16:9 ������

������ 3: ������������������ DPI

from pdf2ppt import pdf_to_ppt

pdfs = ["doc1.pdf", "doc2.pdf", "doc3.pdf"]

for pdf in pdfs:
    # ��������������������� DPI���
    pdf_to_ppt(pdf, pdf.replace(".pdf", "_������.pptx"), dpi=150)

    # ��������������� DPI���
    pdf_to_ppt(pdf, pdf.replace(".pdf", "_������.pptx"), dpi=300)

���� ������������

������ 1: "Unable to get page count"

������: ��������� poppler ��������������� PATH

������: ������������"������"��������� poppler ������������

������ 2: ������������

������: DPI ������������������������

������: ������ DPI������ 150-200���

������ 3: ������������

������: DPI ������

������: ������ DPI��������� 300���

���� ������

������������

git clone https://github.com/yourusername/pdf2ppt.git
cd pdf2ppt

������������������

pip install -e ".[dev]"

������������

pytest tests/

���� ���������

MIT License

���� ������

������������ Issue ��� Pull Request���

���� ������������

���� ������

���������������������������������������:

  • pdf2image - PDF ���������������
  • python-pptx - PowerPoint ������
  • Pillow - ������������
  • NumPy - ������������

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdf2ppt_converter-1.0.0.tar.gz (9.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pdf2ppt_converter-1.0.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pdf2ppt_converter-1.0.0.tar.gz.

File metadata

  • Download URL: pdf2ppt_converter-1.0.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for pdf2ppt_converter-1.0.0.tar.gz
Algorithm Hash digest
SHA256 00673687f7885ccec005df857933d72bae442267b3be1f71564ab5faabe865a3
MD5 a77658dac53c14cfbb64b1d85612cd7c
BLAKE2b-256 08e99c252876b9b52ce951223ceb8843bc5102f21b495716d0d6c4b19ae5306d

See more details on using hashes here.

File details

Details for the file pdf2ppt_converter-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pdf2ppt_converter-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 dc9f391e9c071d09b3f2a321084432e216f84b7b7b6e8af59e40004f9e931231
MD5 408fbc66cc22f5960141ce3f67e6df5d
BLAKE2b-256 02bafa8ee2c29ac4f04a11255359bb75b3fc105e5fe386323fdc5ce894c22816

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page