Skip to content

question: how to text_color of free_text annotation #4283

Answered by JorjMcKie
TwoDeen asked this question in Q&A
Discussion options

You must be logged in to vote

Example:

blocks=page.get_text("dict",clip=annot.rect)["blocks"]
for b in blocks:
    for l in b["lines"]:
        for s in l["spans"]:
            print(f"{s['color']=}, {s['text']=}, {s['font']=}")

            
s['color']=0, s['text']='           ', s['font']='CharisSIL'
s['color']=0, s['text']='PyMuPDF ', s['font']='CharisSIL'
s['color']=16711680, s['text']='འདི་', s['font']='NotoSerifTibetan-Regular'
s['color']=16711680, s['text']=' ', s['font']='CharisSIL'
s['color']=16711680, s['text']='ཡིག་ཆ་བ', s['font']='NotoSerifTibetan-Regular'
s['color']=16711680, s['text']='´མ་ѯེལ་êི་དོན་ϊ་', s['font']='NotoSerifTibetan-Regular'
s['color']=16711680, s['text']=' ', s['font']='CharisSIL'
s['color'

Replies: 3 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@JorjMcKie
Comment options

Answer selected by JorjMcKie
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #4282 on February 11, 2025 12:04.