V
V
vladqwelkj2020-04-01 22:28:29
Python
vladqwelkj, 2020-04-01 22:28:29

How to get the highlight color of a character in a document using python?

In a pdf document, you need to know the highlight color of each character. Where to dig to solve this problem? Pdfminer is not suitable (I read that it is not about colors). PyPDF, python-docx (converted pdf to docx, with formatting preserved) - I can't find the necessary functionality there.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
vladqwelkj, 2020-04-01
@vladqwelkj

Found something (only for .docx):

import docx
doc = docx.Document('1.docx')
for p in doc.paragraphs:
    for r in p.runs:
        print(r.font.highlight_color, r.text)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question