pptxtopdf 0.0.2

Creator: railscoder56

Last updated:

Add to Cart

Description:

pptxtopdf 0.0.2

PowerPoint to PDF Converter
This is a Python script that converts PowerPoint files (.ppt, .pptx) to PDF format. It uses the comtypes library to interact with Microsoft PowerPoint.
Prerequisites

Python 3.6 or above

Dependancies

comtypes library

Usage
Run the script with the following arguments i.e pptxtopdf --input_dir "C:\Users\Example\Downloads\input":

--input_file: Path to the folder containing the PowerPoint files to convert.
--input_dir: Path to the folder containing the PowerPoint files to convert.
--output_dir: [Optional] Path to the folder where the converted PDF files will be saved. If not provided, it defaults to the same directory as the input file or directory.

Example from command line
pptxtopdf --input_dir ./input --output_dir ./output

This command will convert all the PowerPoint files in the ./input folder and save the converted PDF files in the ./output folder.
Example in script
from pptxtopdf import convert

input_dir = r"C:\Users\Example\ExampleDirectory"
output_dir = r"C:\Users\Example\ExampleDirectory"

convert(input_dir, output_dir)

Functionality
The script performs the following steps:

Validates the input folder path and checks if it exists.
Creates the output folder if it does not already exist.
Lists all the files in the input folder.
Iterates over each file and checks if it has a PowerPoint extension.
Creates a PowerPoint application object using comtypes.
Opens the PowerPoint slides.
Retrieves the base file name.
Constructs the output file path with the PDF extension.
Checks if the output file already exists and skips the conversion if it does.
Saves the slides as a PDF file.
Closes the slide deck.
Quits PowerPoint.
Keeps track of the successful conversions and errors.
Prints a summary of the conversion process at the end.

Note: The script runs without a user interface (WithWindow=False) to perform the conversions silently.
Error Handling
If any error occurs during the conversion process, the script will catch the exception and print an error message specifying the file that caused the error.
License
This script is released under the MIT License. Feel free to modify and use it according to your needs.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.