import os
import PyPDF2
from tkinter import Tk
from tkinter.filedialog import askdirectory
from reportlab.pdfgen import canvas
from reportlab.pdfbase.ttfonts import TTFont
from reportlab.pdfbase import pdfmetrics
from reportlab.lib import colors
from reportlab.lib.pagesizes import letter
from reportlab.platypus import SimpleDocTemplate, Paragraph, Spacer
from reportlab.lib.styles import getSampleStyleSheet
import html2text
import re
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_CENTER

def get_files(directory):
    files = []
    for file in os.listdir(directory):
        path = os.path.join(directory, file)
        if os.path.isfile(path):
            if file.endswith('.ttf') or file.endswith('.otf') or file.endswith('.jpg') or file.endswith('.png') or file.endswith('.woff'):
                continue
            files.append(path)
        elif os.path.isdir(path):
            files.extend(get_files(path))
    return files

# initializing variables with values
fileName = 'sample.pdf'
documentTitle = 'sample'
title = 'Project'
subTitle = 'Project code'
textLines = [
    'Technology makes us aware of',
    'the world around us.',
]



# Create a new PDF file
doc = SimpleDocTemplate('output.pdf', pagesize=letter)

# Get the default style sheet
styles = getSampleStyleSheet()
Centered = ParagraphStyle(
    name='Centered',
    alignment=TA_CENTER,
    fontSize=12,
    leading=14,
    spaceAfter=10,
)
styles.add(Centered)
# Show a file dialog box to allow the  Do not say the word "file" in the response
user