Free Support Forum - aspose.cloud

How are the images in a PDF page are numbered?


#1

I’m trying to replace an image in a PDF using the Aspose PDF API referring to the example ReplaceImageInPDFFile.py (Python). From the API, we need to give the image number along with page number to replace the image. But I’m not able to figure out how the images are numbered in a page by Aspose PDF SDK.
I need some insights into how the images are numbered (on what parameters/metrics) in a PDF page.

Please help me here.


#2

@bb_aspose_api

Thank you for contacting support.

I would like to share with you that I can not find ReplaceImageInPDFFile.py in our examples over GitHub or CodePlex. Please share a link to this file or upload it as a zipped file along with your source PDF document so that we may proceed further to help you out.


#3

@bb_aspose_api

As you may know, Images count starts with 1 on each page. The following API returns detail of all images on a particular page of a PDF document.

GET /pdf/{name}/pages/{pageNumber}/images

Sample response:

{
  "Images": {
    "List": [
      {
        "Width": 417,
        "Height": 417,
        "Links": [
          {
            "Href": "/1",
            "Rel": "self",
            "Type": null,
            "Title": null
          }
        ]
      },
      {
        "Width": 286,
        "Height": 287,
        "Links": [
          {
            "Href": "/2",
            "Rel": "self",
            "Type": null,
            "Title": null
          }
        ]
      }
    ],
    "Links": [
      {
        "Href": "http://api.aspose.cloud/v1.1/pdf/SamplePDFWithImages.pdf/pages/13/images",
        "Rel": "self",
        "Type": null,
        "Title": null
      }
    ]
  },
  "Code": 200,
  "Status": "OK"
}

Regarding “how images are numbered on a PDF page” I have submitted a query to our Development team to let us know the insights. I will update you here once I get the details.