ImageOperation GetImageProperties Function. Get the image information for all the raster images. ABCpdf .NET PDF Library.

ABCpdf .net

 
   

Get the image information for all the raster images.

 

   
Syntax  

[C#]
ICollection<ImageProperties> GetImageProperties()
[Visual Basic]
Function GetImageProperties() As ICollection<ImageProperties>

Throws Exceptions may throw Exception()

 

   

Params
 
Name Description
Return A collection of all the image properties..

 

   

Notes
 

Get the image information for all the raster images. If the PageContents is null then an exception will be raised.

After retrieving image properties you can iterate through them to find out information about what images there are and how they are placed in the document. Much like HTML, PDF allows a divorce between the image and the placement of that image. So you may have one PixMap which is drawn multiple times at multiple sizes in different locations within the document.

 

   

Example
 

Here we highlight a set of images in a source document by drawing a red rectangle around each one.

[C#]
string theSrc = Server.MapPath("Acrobat.pdf");
string theDst = Server.MapPath("HighlightedImages.pdf");
using (Doc theDoc = new Doc()) {
  theDoc.Read(theSrc);
  theDoc.Color.SetRgb(255, 0, 0);
  theDoc.Width = 0.1;
  ImageOperation op = new ImageOperation(theDoc);
  op.PageContents.AddPages();
  ICollection<ImageProperties> images = op.GetImageProperties();
  foreach (ImageProperties pl in images) {
    foreach (ImageRendition plc in pl.Renditions) {
      plc.Focus();
      theDoc.FrameRect();
    }
  }
  theDoc.Save(theDst);
}

[Visual Basic]
Dim theSrc As String = Server.MapPath("Acrobat.pdf")
Dim theDst As String = Server.MapPath("HighlightedImages.pdf")
Using theDoc As New Doc()
  theDoc.Read(theSrc)
  theDoc.Color.SetRgb(255, 0, 0)
  theDoc.Width = 0.1
  Dim op As New ImageOperation(theDoc)
  op.PageContents.AddPages()
  Dim images As ICollection(Of ImageProperties) = op.GetImageProperties()
  For Each pl As ImageProperties In images
    For Each plc As ImageRendition In pl.Renditions
      plc.Focus()
      theDoc.FrameRect()
    Next
  Next
  theDoc.Save(theDst)
End Using