from fpdf import FPDF
pdf = FPDF('P', 'mm', (100,100))
# Add a page
pdf.add_page()
# set style and size of font
# that you want in the pdf
pdf.add_font('ariblk', '', "ArialBlack.ttf", uni=True)
pdf.set_font("ariblk",size = int(50*0.8))
text = [['a','b','c','d','e','w','q'],['f','g','h','i','j','k','l']]
print("creating pdf...")
line = 0
for w in range(0,len(text)):
for h in range(0,len(text[w])):
# create a cell
r = int (50)
g = int (100)
b = int (10)
pdf.set_text_color(r, g, b)
text_out = text[w][h]
pdf.cell(0,line, txt = text_out, ln = 2)
# save the pdf with name .pdf
pdf.output(name = "img/output.pdf", dest='F')
print("pdf created!")
Und genau das ist meine Codeausgabe:
(Dies ist Kopierpaste aus der Ausgabe PDF): iljfBeqaghdckw
(Dies ist ein Screenshot der Ausgabe):
Ich versuche, ein PDF mit Python zu erstellen, und [url=viewtopic.php?t=14917]ich möchte[/url] einen Text in PDF -Zeichen von char einfügen.[code]from fpdf import FPDF
pdf = FPDF('P', 'mm', (100,100)) # Add a page pdf.add_page()
# set style and size of font # that you want in the pdf pdf.add_font('ariblk', '', "ArialBlack.ttf", uni=True) pdf.set_font("ariblk",size = int(50*0.8)) text = [['a','b','c','d','e','w','q'],['f','g','h','i','j','k','l']] print("creating pdf...") line = 0 for w in range(0,len(text)): for h in range(0,len(text[w])): # create a cell r = int (50) g = int (100) b = int (10) pdf.set_text_color(r, g, b) text_out = text[w][h] pdf.cell(0,line, txt = text_out, ln = 2)
# save the pdf with name .pdf pdf.output(name = "img/output.pdf", dest='F') print("pdf created!") [/code] Und genau das ist meine Codeausgabe: (Dies ist Kopierpaste aus der Ausgabe PDF): iljfBeqaghdckw (Dies ist ein Screenshot der Ausgabe):
Ich baue den Versuch, mit FPDF einen PDF -Bericht in Python zu erstellen. Ich möchte einige Daten aus meiner in einem Datenrahmen gespeicherten Analyse entnehmen und Tabellen und Diagramme erstellen....
Ich habe ein Formular, aus diesem Formular verwende ich Jquery Ajax, um die Werte in FPDF zu veröffentlichen, um einen PDF auf dem Server zu speichern. Dann möchte ich, dass der Browser den PDF in...