add the PDF class

This commit is contained in:
Andreas Zweili 2021-05-16 17:08:54 +02:00
parent 8915f7794d
commit d8cf2c0896
1 changed files with 39 additions and 0 deletions

39
pdf.py Normal file
View File

@ -0,0 +1,39 @@
from PyPDF2 import PdfFileWriter, PdfFileReader
class PDF:
__init__(pathname):
self.pathname = pathname
def _get_pdf():
return False
def _clean_filename():
return False
def _create_folder():
self._clean_filename()
return False
def _compress_folder():
return False
def _split_pdf():
input_pdf = PdfFileReader("input-file.pdf")
output = PdfFileWriter()
output.addPage(input_pdf.getPage(0))
with open("first_page.pdf", "wb") as output_stream:
output.write(output_stream)
return False
def _cleanup():
return False
def split():
self._get_pdf()
self._create_folder()
self._split_pdf()
self._compress_folder()
self._cleanup()