0

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!

Community
  • 1
  • 1
Mike
  • 1,221
  • 3
  • 15
  • 34

1 Answers1

0

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

Community
  • 1
  • 1
Chris Haas
  • 53,986
  • 12
  • 141
  • 274