Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

fpdf latin-1

import fpdf
fpdf.set_global("SYSTEM_TTFONTS", os.path.join(os.path.dirname(__file__),'fonts'))
Comment

fpdf latin-1

pdf = fpdf.FPDF()
pdf.add_font("NotoSans", style="", fname="NotoSans-Regular.ttf", uni=True)
pdf.add_font("NotoSans", style="B", fname="NotoSans-Bold.ttf", uni=True)
pdf.add_font("NotoSans", style="I", fname="NotoSans-Italic.ttf", uni=True)
pdf.add_font("NotoSans", style="BI", fname="NotoSans-BoldItalic.ttf", uni=True)
Comment

fpdf latin-1

pdf.set_font("NotoSans", size=12)
Comment

fpdf latin-1

from datetime import datetime
def getFileName():
    now=datetime.now()
    time = now.strftime('%d_%H_%M_%S')
    filename = "Test_"+time + ".pdf"
    return filename


from fpdf import FPDF

pdf = FPDF()

#Download NotoSansArabic-Regular.ttf from Google noto fonts
pdf.add_font("NotoSansArabic", style="", fname="./fonts/NotoSansArabic-Regular.ttf", uni=True)


pdf.add_page()

pdf.set_font('Arial', '', 12)
pdf.write(8, 'Hello World')
pdf.ln(8)

# مرحبا Marhaba in arabic 
pdf.set_font('NotoSansArabic', '', 12)
text = 'مرحبا'
pdf.write(8, text)
pdf.ln(8)

pdf.output(getFileName(), 'F')
Comment

PREVIOUS NEXT
Code Example
Python :: python os.listdir attributes 
Python :: python increase a value every n rows 
Python :: mid point line drawing 
Python :: if statment with logical or operator for multiple varaibles 
Python :: python __div__ 
Python :: __truediv__ 
Python :: Exception has occurred: FileNotFoundError 
Python :: NumPy rot90 Example Rotating Once 
Python :: selenium rotate user agent 
Python :: change bg awesomewm 
Python :: Snippet for inverse a matrix using numpy 
Python :: how to do something daily python 
Python :: pandas aggregate rename column 
Python :: cast set 
Python :: penggunaan keys di python 
Python :: Double all numbers using a map() Function 
Python :: make dialog in the front by Pywinauto 
Python :: python get dataframe vlaues where cell is higher than 
Python :: preallocate numpy array 
Python :: seaborn colorbar labelsize 
Python :: lxml etree fromstring find 
Python :: how to map url with usernames prefixed 
Python :: how to wait 5 seconds in python 
Python :: python return inline if 
Python :: ring retrieves the list of all algorithms supported by Encrypt()/Decrypt() functions. 
Python :: ring execute the program line by line 
Python :: matplotlib plot dpi - change format to svg 
Python :: import sys execute cmd 
Python :: insertar en una lista anidada python 
Python :: list.count all 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =