itextsharp color picker for a area

I needed to insert some text (a ID) in a location on a PDF file.This task was simple enough but I'm running in to an issue when there is color under the font location.

I need to test to see what color(if any) is under a defined area. Then determine if the font color should be Black or White.

I found a great routine Here (on StackOverflow). to help determine what color to use based on a color you send it. I was hoping to see if there was anyway to find that information out using ITextSharp.

any help would be great!


The short answer is no. The color that a human eye would perceive at any specific x,y coordinate falls under the realm of a PDF renderer which iText is not.

If I were you I would use Ghostscript to convert the PDF to an image such as a PNG or JPEG and then load that into a System.Drawing.Bitmap object and call GetPixel

链接地址: http://www.djcxy.com/p/87050.html

上一篇: 检测重叠周期的算法

下一篇: 一个区域的itextsharp颜色选择器