Erstellen von PDF mit Python mit FPDF char von charPython

Python-Programme
Anonymous
 Erstellen von PDF mit Python mit FPDF char von char

Post by Anonymous »

Ich versuche, ein PDF mit Python zu erstellen, und ich möchte einen Text in PDF -Zeichen von char einfügen.

Code: Select all

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):

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post