Skip to content

Ability to use subscript/superscript? #298

Answered by Lucas-C
gumbald asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @gumbald

Sadly there is currently no simple way to render subscript/superscript using fpdf2...
This could a useful feature to add!

In the meantime, you may have to rely on a manual approach similar to this code:

pdf = FPDF(format="letter", unit="pt")
pdf.add_page()
pdf.set_font("helvetica", size=36)
pdf.cell(border="TBL", txt="Lorem ipsum")
x, y = pdf.x, pdf.y
pdf.cell(border="TBR", txt="    nostrud irure")
pdf.set_font_size(20)
pdf.set_xy(x, y)
pdf.cell(txt="Sup")
pdf.set_xy(x, y+20)
pdf.cell(txt="Sub")
pdf.output("discuss_298.pdf")

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Lucas-C
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants