Work with Text in PDF using Python
Contents
[
Hide
]
We all sometimes need to add text to a PDF file. For example, you may want to place a translation below the main text, add a caption next to an image, or fill out an application form. It is also helpful when all text elements can be formatted in your preferred style. Common text operations include adding text, formatting text, replacing text, and rotating text in a document. Aspose.PDF for Python via .NET provides everything you need to work with PDF text content.
Use this section when you need to generate, format, inspect, or modify text directly inside PDF pages in Python applications.
Text Tasks Covered
You are able to do the following:
- Add Text to PDF file - add text to your PDF, use fonts from stream and files, add an HTML string, add a hyperlink, etc.
- PDF Tooltip - you may add a tooltip to searched text by adding an invisible button using Python.
- Using FloatingBox - place styled text and other content inside a floating container.
- Replace Text in PDF - replace or remove existing text in a PDF file.
- Rotate Text Inside PDF - rotate text fragments and paragraphs inside a PDF.
- Search and Get Text from PDF - search text and inspect extracted text details from pages.
- Text Formatting inside PDF - control line spacing, borders, indentation, and text styling.