-
Notifications
You must be signed in to change notification settings - Fork 46
Add a square with the text #58
Comments
Yes, you can. Attaching a working code that can make a box and a background color. -- coding: utf-8 -- author: Eyal Michaeli, [email protected]
from pdf_annotate import PdfAnnotator, Location, Appearance Font size: Background Colors: Font Colors: def add_text_with_rect(text_to_annotate, page, x1=20, y1=750, x2=135, y2=775, backColor=blue, type='', bold=False): Adds the annotation:content_stream = ContentStream([ If you want the annotaion content to be BOLD:if bold == True: |
I just did similar things and hope my script could help you a bit. a.add_annotation(
'square',
Location(x1=x1, y1=y1, x2=x2, y2=y2, page=page),
Appearance(stroke_color=(1, 0, 0), stroke_width=2),
)
a.add_annotation(
'text',
Location(x1=x1+5, y1=y1, x2=x2, y2=y2, page=page),
Appearance(
fill=[0.4, 0, 0],
stroke_width=1,
font_size=10,
content=filename,
),
) The The difference between The difference between |
Hi
I didn't understand if I can add a square automatically with the text annotation. and if so, how?
The text was updated successfully, but these errors were encountered: