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
- hyperlink (
-
pdfpug.common.
bold
(text)¶ Formats the text to appear bold
Parameters: text ( str
) – Text to be bold formattedReturn type: str
-
pdfpug.common.
italic
(text)¶ Formats the text to appear italicized
Parameters: text ( str
) – Text to be italic formattedReturn type: str
-
pdfpug.common.
underline
(text)¶ Formats the text to appear underlined
Parameters: text ( str
) – Text to be underline formattedReturn type: str
-
pdfpug.common.
strike
(text)¶ Formats the text to appear striked through
Parameters: text ( str
) – Text to be strike through formattedReturn type: str
-
pdfpug.common.
superscript
(text)¶ Formats the text to appear as a superscript
Parameters: text ( str
) – Text to be superscript formattedReturn type: str
-
pdfpug.common.
subscript
(text)¶ Formats the text to appear as a subscript
Parameters: text ( str
) – Text to be subscript formattedReturn type: str