We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Determine the color of a coordinate in a PDF

I'm using the Syncfusion File Formats library in a console application referencing .NET Framework 4.7.2 to create PDFs based on values passed to the program.

So far everything works properly, but was wondering if given a location on the page (x,y) is there a way to return what color is at that location.  I'm wanting to draw a line up to the point a color matching a color used in an image is found.

1 Reply

KC Karthikeyan Chandrasekar Syncfusion Team February 26, 2019 05:02 AM UTC

Hi Brian, 
Greetings from Syncfusion. 
Yes you can achieve this requirement by following the below steps. 
  1. Convert PDF to Image using the below code snippet.
// Load PDF document 
PdfLoadedDocument ldDoc = new PdfLoadedDocument("input.pdf"); 
// Convert first page to image 
Bitmap page0 = ldDoc.ExportAsImage(0); 
  1. Get the color from the image using the GetPixel method.
Regards 
Karthikeyan   


Loader.
Live Chat Icon For mobile
Up arrow icon