Text Formatters

The text formatter functions help set various styles to text like making it bold, underline, strikethrough, superscript etc. They can be used within any of PdfPug’s modules to further customize them to suit different use cases.

For example,

from pdfpug.modules import Paragraph, Header

# Italicized header
header = Header(italic("PdfPug"))

# Paragraph with a URL
para = Paragraph(f"{url('https://pypi.org/project/pdfpug/', 'PdfPug PyPi Page')}")
pdfpug.common.url(hyperlink, text=None)

Create a hyperlink

Note

If text is not provided, the hyperlink will be used as the visible text

Parameters:
  • hyperlink (str) – URL to resource
  • text (Optional[str]) – Text displayed instead of hyperlink
Return type:

str

pdfpug.common.bold(text)

Formats the text to appear bold

Parameters:text (str) – Text to be bold formatted
Return type:str
pdfpug.common.italic(text)

Formats the text to appear italicized

Parameters:text (str) – Text to be italic formatted
Return type:str
pdfpug.common.underline(text)

Formats the text to appear underlined

Parameters:text (str) – Text to be underline formatted
Return type:str
pdfpug.common.strike(text)

Formats the text to appear striked through

Parameters:text (str) – Text to be strike through formatted
Return type:str
pdfpug.common.superscript(text)

Formats the text to appear as a superscript

Parameters:text (str) – Text to be superscript formatted
Return type:str
pdfpug.common.subscript(text)

Formats the text to appear as a subscript

Parameters:text (str) – Text to be subscript formatted
Return type:str