pdf.add_text
result = pdf.add_text(src, page, x, y, text, [size=12], [color=[0,0,0]], [font="Helvetica"])
Input: src, page, x, y, text, size, color, font · Output: result
What it is
Stamps one line of text on a page with its baseline starting at (x, y) in PDF points from the bottom-left of the unrotated page (/Rotate and /CropBox are not compensated). font is one of the 12 standard fonts (Helvetica, Helvetica-Bold, Times-Roman, Courier, ...); text is WinAnsi-encoded, so characters outside Western European + common punctuation, and newlines, are errors. The existing page content is wrapped in q/Q so it cannot affect the stamp.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = pdf.add_text(src, page, x, y, text, [size=12], [color=[0,0,0]], [font="Helvetica"]) | src —not documented yetpage —Stamps one line of text on a page with its baseline starting at (x, y) in PDF points from the bottom-left of the unrotated page (/Rotate and /CropBox are not compensated).x —Stamps one line of text on a page with its baseline starting at (x, y) in PDF points from the bottom-left of the unrotated page (/Rotate and /CropBox are not compensated).y —Stamps one line of text on a page with its baseline starting at (x, y) in PDF points from the bottom-left of the unrotated page (/Rotate and /CropBox are not compensated).text —text is WinAnsi-encoded, so characters outside Western European + common punctuation, and newlines, are errors.size optional (default 12)not documented yetcolor optional (default [0,0,0])not documented yetfont optional (default "Helvetica")font is one of the 12 standard fonts (Helvetica, Helvetica-Bold, Times-Roman, Courier, ...). | result Vec | Returns a Vec of bytes; the stamp is simple-font text, so pdf.replace_text can edit it later. |
Examples
No documentation example calls this form yet. The File I/O chapter is where one belongs.