#python program
#Create PDF FILE
from fpdf import fpdf
# Save FPDF() class into avariable PDF
pdf=FPDF()
#Add a page
pdf.add_page()
#Font Style & Font Size
pdf.set_font("Verdana", size=10)
#Create A Cell
pdf.cell(150,10, txt="File Converter", In=1, align='C')
#Create Another Cell
pdf.cell(150,10, txt="File Converter1", In=1, align='C')
#Save PDF with name
pdf.output("abc.pdf")
#Convert text file to Pdf File
from fpdf import fpdf
# Save FPDF() class into avariable PDF
pdf=FPDF()
#Add a page
pdf.add_page()
#Font Style & Font Size
pdf.set_font("Verdana", size=10)
#open Text file in Read mode
f=open("file.txt", "r")
#insert text in pdf
for x in f;
pdf.cell(150,10, txt="x", In=1, align='C')
#save pdf
pdf.output("abc.pdf")
Get Answers For Free
Most questions answered within 1 hours.