pdfbox-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nicholas Poon <nicholas_p...@yahoo.com.INVALID>
Subject Highlighted text annotation -- extract color and show in English name
Date Tue, 19 Aug 2014 13:41:57 GMT
Hi, actually I tried with getR, getG and getB before but it seems like the numbers returned
are not talking about the color of the highlighted text box. I just highlighted the text
by Adobe Reader with default yellow color, red and blue color at different area. One strange
thing is even I am using same color (e.g. yellow) to highlight at different areas, the PDGamma
strings returned with different values.

For getR, getG and getB, I can only get 1 or 0, but not hex-codes or decimal figures for RGB
conversion.

I wish to get the highlighted text area color but not the text color, any further hints? 
Thanks.

System.out.println(pdfAnnot.getColour());
System.out.format("getR(): %f%n", pdfAnnot.getColour().getR());
System.out.format("getG(): %f%n", pdfAnnot.getColour().getG());
System.out.format("getB(): %f%n", pdfAnnot.getColour().getB());

org.apache.pdfbox.pdmodel.graphics.color.PDGamma@643b1d11
getR(): 1.000000
getG(): 1.000000
getB(): 0.000000
org.apache.pdfbox.pdmodel.graphics.color.PDGamma@5034c75a
getR(): 1.000000
getG(): 1.000000
getB(): 0.000000
org.apache.pdfbox.pdmodel.graphics.color.PDGamma@62ee68d8
getR(): 1.000000
getG(): 1.000000
getB(): 0.000000

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message