Apr-03-2020, 05:44 AM
I have been working on getting my program to make a PDF of all the data in various widgets. I have been able to get the data and it does create a PDF file however the formatting is not correct. I need to learn know how to make the lines of the populated widget but the PDF made has a line of data for each widget and the widgets that have a larger amount of data is posted one a single line.
As an example, this code should look like below:
;====================================== ;-Program: GOJHL v2.1 ; Language: Pure Basic ; Written by: John Coones Jr. ; Date: April 08, 2016 ; Copyright 2014-2016
Here is my current PDF code:
A little help to get the data to save in PDF as it shows in the widget would be appreciated.
Thanks again.
As an example, this code should look like below:
;====================================== ;-Program: GOJHL v2.1 ; Language: Pure Basic ; Written by: John Jr. ; Date: April 08, 2016 ; Copyright 2014-2016But it saves in the PDF as:
;====================================== ;-Program: GOJHL v2.1 ; Language: Pure Basic ; Written by: John Coones Jr. ; Date: April 08, 2016 ; Copyright 2014-2016
Here is my current PDF code:
def makePDF():
try:
pdf=FPDF(orientation='P', unit='mm', format='A3')
pdf.add_page()
pdf.set_font("Arial", size = 10)
pdf.cell(200, 10, txt = "PBSnippet",
ln = 1, align = 'L')
f = (Code_Type.get(), Snippet_Name.get(), Code_Snippet.get('1.0', END), Description.get('1.0',END), Date.get(), Author.get(), Version.get())
for x in f:
pdf.cell(200, 10, txt = x, ln = 1, align = 'L')
pdf.output("PBSnippet.pdf")
except:
messagebox.showerror('PBSnippet', 'Failed to create the PDF!')The data from Description and Code_Snippet are multiple lines and are displaying as a single line as shown above.A little help to get the data to save in PDF as it shows in the widget would be appreciated.
Thanks again.
"Often stumped... But never defeated."
