Gets string information about an object.




string GetInfo(int id, string type)

[Visual Basic]
Function GetInfo(id As Integer, type As String) As String



Name Description

The Object ID of the object to be queried.


The type of information to be retrieved.

return The returned information.




After you modify a document you may want to get back information about the objects you have added. For example you might want to find out the natural dimensions of an image or you might want to find out how many characters were drawn when you inserted some text. This method allows you access to this information.

There are core information types that all objects support. There are also information types specific to particular types of object. You can use core information types to allow you to iterate through every object in your document finding out specific information about each of them.

If the object does not exist or does not support the requested type of information then an empty string is returned.

Every object supports the ID and Type properties. For more detailed information about this and other properties see the Object Paths section of this document.

PDF objects are case sensitive so be sure you use the correct case when specifying information.




The following code snippet illustrates how one might report the natural dimensions of an image.


using (Doc doc = new Doc()) {
  string thePath = Server.MapPath("../mypics/mypic.jpg");
  int theID1 = doc.AddImageFile(thePath, 1);
  int theID2 = doc.GetInfoInt(theID1, "XObject");
  string theWidth = doc.GetInfo(theID2, "Width");
  string theHeight = doc.GetInfo(theID2, "Height");
  Response.Write($"Width {theWidth}< br>");
  Response.Write($"Height {theHeight}< br>");

[Visual Basic]
Using doc As New Doc()
  Dim thePath As String = Server.MapPath("../mypics/mypic.jpg")
  Dim theID1 As Integer = doc.AddImageFile(thePath, 1)
  Dim theID2 As Integer = doc.GetInfoInt(theID1, "XObject")
  Dim theWidth As String = doc.GetInfo(theID2, "Width")
  Dim theHeight As String = doc.GetInfo(theID2, "Height")
  Response.Write($"Width {theWidth}< br>")
  Response.Write($"Height {theHeight}< br>")
End Using

This is the kind of output you might expect.

Width 480
Height 640