Hey there, is there a way to make it compatible for arbitrary text, indentation, paragraphs?
from fpdf import FPDF
def text_to_pdf(text_file, pdf_file):
with open(text_file, "r") as file:
text = file.read()
# Creating an instance of pdfclass
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size=12)
# Add the text to the PDF -> How can I make it get arbitrary text, paragraphs or pages.
pdf.multi_cell(190, 12, txt=text, align="L")
pdf.output(pdf_file)
text_file = "simple.txt"
pdf_file = "simple.pdf"
text_to_pdf(text_file, pdf_file)