Android Question Create Different Size Font in a PDF File

M Zuhri

Member
Licensed User
Hi
can anyone help me. i want to make a POS receipt in PDF.
in that case, how i can define font size and weight for given title or word in that file,
for ex.
Title should be large and bold, date and time in bold, line item in regular size,
footer message in italic like that.

Regards
 

DonManfred

Expert
Licensed User
Longtime User
Printing and Pdf creation

The example shows to use a font.

B4X:
Dim pdf As PdfDocument
pdf.Initialize
pdf.StartPage(595, 842) 'A4 size
pdf.Canvas.DrawLine(2, 2, 593 , 840, Colors.Blue, 4)
pdf.Canvas.DrawText("Hello", 100, 100, Typeface.DEFAULT_BOLD, 30 / GetDeviceLayoutValues.Scale , Colors.Yellow, "CENTER")
pdf.FinishPage
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "1.pdf", False)
pdf.WriteToStream(out)
out.Close
pdf.Close
 
Upvote 0
Top