Skip to content

Commit

Permalink
0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Swarag-N committed Sep 22, 2020
1 parent 6f31e26 commit 5d7b94a
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 156 deletions.
22 changes: 20 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
# PowerPoint to PDF
# PPT2PDF

A command line tool to convert PowerPoint (PPT/PPTX) files to Adobe PDF.

For a single file simply run

```console
ppt2pdf file input.ppt
```

For converting multiple files in a directory run

```console
ppt2pdf dir .
```

use -s/--select flag to select the files in directory

## PowerPoint to PDF

A set of Python scripts to convert PowerPoint (PPT/PPTX) files to Adobe PDF

Expand All @@ -9,4 +27,4 @@ A set of Python scripts to convert PowerPoint (PPT/PPTX) files to Adobe PDF
Please see each script for full instructions on how to use the script.

My Implemenation of the Scripts
![Folder](docs\images\folderScript.gif)
![Folder](.\docs\images\folderScript.gif)
33 changes: 0 additions & 33 deletions ppt2pdf/Convert.py

This file was deleted.

74 changes: 0 additions & 74 deletions ppt2pdf/ConvertFolder.py

This file was deleted.

67 changes: 22 additions & 45 deletions ppt2pdf/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,25 @@
import os
import comtypes.client
from pyfiglet import Figlet

class PPT2PDF():

def __init__(self):
f = Figlet(font='isometric1')
print(f.renderText('PPT 2 PDF'))



def _generateOutputFilename(self,outputFilename):
output = os.path.splitext(outputFilename);
output=os.path.abspath(output[0]+".pdf");
return output;


def convert(self, inputFilePath,outputFilePath):

print("Your Input file is at:")
print(inputFilePath)

if(not outputFilePath):
outputFilePath = self._generateOutputFilename(inputFilePath);

print("Your Output file will be at:")
print(outputFilePath);

# %% Create powerpoint application object
powerpoint = comtypes.client.CreateObject("Powerpoint.Application")
#%% Set visibility to minimize
powerpoint.Visible = 1
#%% Open the powerpoint slides
slides = powerpoint.Presentations.Open(inputFilePath)
#%% Save as PDF (formatType = 32)
slides.SaveAs(outputFilePath, 32)
#%% Close the slide deck
slides.Close()


def convertSingleFile(self,inputFilePath,output):
if(not output):
output=self._generateOutputFilename(inputFilePath)
self.convert(inputFilePath,output)

def testImport(self):
print("Yesssssssssssssssssssssssssssss");
from ppt2pdf.utils import generateOutputFilename


def convert(inputFilePath,outputFilePath):

# print("Your Input file is at:")
# print(inputFilePath)
if(not outputFilePath):
outputFilePath = generateOutputFilename(inputFilePath);

# print("Your Output file will be at:")
# print(outputFilePath);
# %% Create powerpoint application object
powerpoint = comtypes.client.CreateObject("Powerpoint.Application")
#%% Set visibility to minimize
powerpoint.Visible = 1
#%% Open the powerpoint slides
slides = powerpoint.Presentations.Open(inputFilePath)
#%% Save as PDF (formatType = 32)
slides.SaveAs(outputFilePath, 32)
#%% Close the slide deck
slides.Close()
15 changes: 15 additions & 0 deletions ppt2pdf/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import sys
import os

def createCheckBoxes(files):
modified_list = []
for file in files:
temp = {}
temp['name'] = file
modified_list.append(temp)
return modified_list

def generateOutputFilename(outputFilename):
output = os.path.splitext(outputFilename);
output=os.path.abspath(output[0]+".pdf");
return output;
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description-file = README.md
15 changes: 13 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,28 @@

setuptools.setup(
name="ppt2pdf", # Replace with your own username
version="0.0.1",
version="0.0.2",
author="Swarag Narayanasetty",
description="Converts PPT to PDF",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/Swarag-N/powerpoint-to-pdf",
packages=setuptools.find_packages(),
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: BSD 3-Clause License",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
py_modules=['ppt2pdf'],
install_requires=[
'click',
'comtypes'
],
entry_points={
'console_scripts':[
'ppt2pdf=ppt2pdf.scripts.cli:cli'
]
}
)

0 comments on commit 5d7b94a

Please sign in to comment.