Skip to main content

PDFTextWritingTool

Description

Write text at precise coordinates on a PDF page, optionally embedding a custom TrueType font.

Parameters

Run Parameters

  • pdf_path (str, required): Path to the input PDF.
  • text (str, required): Text to add.
  • position (tuple[int, int], required): (x, y) coordinates.
  • font_size (int, default 12)
  • font_color (str, default "0 0 0 rg")
  • font_name (str, default "F1")
  • font_file (str, optional): Path to .ttf file.
  • page_number (int, default 0)

Example

Code

Direct usage

Code

Tips

  • Coordinate origin is the bottom‑left corner.
  • If using a custom font (font_file), ensure it is a valid .ttf.