Foxit Quick PDF Library

Get embedded image coordinates from PDF files

Foxit Quick PDF Library lets you analyze, extract and replace embedded images in PDF files using the extensive image handling functions.

The GetPageImageList function returns an ImageListID which you can use in the GetImageListItemDblProperty function. With this function you can get the coordinates for each image in the image list. The GetImageListItemIntProperty function useful for other image properties. Here is some C# sample code which demonstrates how to retrieve image coordinates for all images in a PDF.

int nd = DPL.LoadFromFile(@"images.pdf", "");
int il = DPL.GetPageImageList(0);
int ic = DPL.GetImageListCount(il);
for (int k = 1; k <= ic; k++)
{
    int gid = DPL.GetImageListItemIntProperty(il, k, 406);
    txtOutput.AppendText("Image ID: " + Convert.ToString(gid));
    txtOutput.AppendText(Environment.NewLine);

    for (int i = 501; i < 509; i++)
    {
        double cOodinate = DPL.GetImageListItemDblProperty(il, ic, i);

        switch (i)
        {
case 501:
    txtOutput.AppendText(i + " Horizontal co-ordinate of top-left corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
case 502:
    txtOutput.AppendText(i + " Vertical co-ordinate of top-left corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
case 503:
    txtOutput.AppendText(i + " Horizontal co-ordinate of top-right corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
case 504:
    txtOutput.AppendText(i + " Vertical co-ordinate of top-right corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
case 505:
    txtOutput.AppendText(i + " Horizontal co-ordinate of bottom-right corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
case 506:
    txtOutput.AppendText(i + " Vertical co-ordinate of bottom-right corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
case 507:
    txtOutput.AppendText(i + " Horizontal co-ordinate of bottom-left corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
case 508:
    txtOutput.AppendText(i + " Vertical co-ordinate of bottom-left corner: " + Convert.ToString(cOodinate));
    txtOutput.AppendText(Environment.NewLine);
    break;
        }

    }
txtOutput.AppendText(Environment.NewLine);
txtOutput.AppendText(Environment.NewLine);

The output will look something like this for every embedded image in the PDF:

Image ID: 1476395011
501 Horizontal co-ordinate of top-left corner: 71.8800049
502 Vertical co-ordinate of top-left corner: 237.1199951
503 Horizontal co-ordinate of top-right corner: 273.9599915
504 Vertical co-ordinate of top-right corner: 237.1199951
505 Horizontal co-ordinate of bottom-right corner: 273.9599915
506 Vertical co-ordinate of bottom-right corner: 85.4400024
507 Horizontal co-ordinate of bottom-left corner: 71.8800049
508 Vertical co-ordinate of bottom-left corner: 85.4400024

This article refers to a deprecated product. If you are looking for support for Foxit PDF SDK, please click here.

Updated on May 16, 2022

Was this article helpful?
Thanks for your feedback. If you have a comment on how to improve the article, you can write it here: