-
I am adding a rectangle annot with fill and stroke colors in RGBA format. (ex: rgba(246,0,0,0.3)) I tried to use to import fitz
fill = fitz.utils.getColor("rgba(246 ,0, 0, 0.3)")
print(fill)
stroke = fitz.utils.getColor("rgba(100, 100, 0, 0.5)")
print(stroke)
doc = fitz.open()
page = doc.newPage()
r = fitz.Rect(10, 10, 100, 100)
annot = page.addRectAnnot(r)
annot.setColors(fill=fill, stroke=stroke)
annot.setBorder(width=1)
annot.update()
doc.save("out.pdf") It would be nice if someone could share me a code snippet? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
This is not supported by PDF itself - a restriction which has nothing to do with (Py-) MuPDF. |
Beta Was this translation helpful? Give feedback.
-
Otherwise please remember that colors in PDF are composed of floats |
Beta Was this translation helpful? Give feedback.
Otherwise please remember that colors in PDF are composed of floats
0 <= c <= 1
not as integers <= 255.