Hi I would like to safe as a pdf etc. my function output. Could you please help me to resolve this tackle ?
Many thanks in advance!
CodePudding user response:
I have used the above article(GFG) and created two custom functions and the output of the custom function is added to pdf.
from fpdf import FPDF
def custom_function():
return 'Hello World'
def new_custom_fuction():
return f'You Custom Value'
pdf = FPDF()
pdf.add_page()
pdf.set_font("Arial", size = 12)
pdf.cell(200, 10, txt = custom_function(), ln = 1, align = "C")
pdf.cell(200, 10, txt = new_custom_fuction(), ln = 1, align = "C")
pdf.output("function_output.pdf")
CodePudding user response:
check out that link Export Pandas DataFrame into a PDF file using Python making a function to automate the process is even more easy
CodePudding user response:
Maybe the information about it on geeksforgeeks helps: https://www.geeksforgeeks.org/convert-text-and-text-file-to-pdf-using-python/