A PDF atomic object comprising a basic chunk of PDF data.

If you are going to be using Atoms then you will want to download the Adobe PDF Specification. This document explains the names and types that can be used and how they are interpreted.

Common Operations.

Get a named property from the dictionary of an IndirectObject. In the example below we use the Type property which is typically a name but the principles are similar for other entries of other types:

[C#]
NameAtom type = io.Resolve(Atom.GetItem(io.Atom, "Type")) as NameAtom;

[Visual Basic]
Dim type As NameAtom = io.Resolve(Atom.GetItem(io.Atom, "Type"))

Get an value out of an array atom. In the the event that the atom is not an array or does not have sufficient entries then the return value will be null. In the example below we are looking for entry two - this is the third entry since entries are zero based:

[C#]
NumAtom num = io.Resolve(Atom.GetItem(atom, 2)) as NumAtom;

[Visual Basic]
Dim num As NumAtom = io.Resolve(Atom.GetItem(atom, 2))

Get a stream referenced from a property of an IndirectObject. In the example below we use the FontFile2 property (a reference to an embedded TrueType font):

[C#]
StreamObject stream = io.ResolveObj(Atom.GetItem(io.Atom, "FontFile2")) as StreamObject;

[Visual Basic]
Dim stream As StreamObject = io.ResolveObj(Atom.GetItem(io.Atom, "FontFile2"))

Add a named entry to an IndirectObject. In the example below we add a V entry which is a string. We keep the returned StringAtom so we can maniplate the value:

[C#]
StringAtom str = (StringAtom)Atom.SetItem(io.Atom, "V", new StringAtom());

[Visual Basic]
Dim str As StringAtom = Atom.SetItem(io.Atom, "V", New StringAtom())

Add a named entry to an IndirectObject. In the example below we add an array entry to specify a border array. Rather than creating an ArrayAtom and specifying the individual values we just specify the raw string value of the object:

[C#]
Atom.SetItem(io.Atom, "Border", Atom.FromString("[ 0 0 1 ]"));

[Visual Basic]
Atom.SetItem(io.Atom, "Border", Atom.FromString("[ 0 0 1 ]"))

 

System.Object
   WebSupergoo.ABCpdf9.Atoms.Atom
      WebSupergoo.ABCpdf9.Atoms.ArrayAtom
      WebSupergoo.ABCpdf9.Atoms.BoolAtom
      WebSupergoo.ABCpdf9.Atoms.DictAtom
      WebSupergoo.ABCpdf9.Atoms.NameAtom
      WebSupergoo.ABCpdf9.Atoms.NullAtom
      WebSupergoo.ABCpdf9.Atoms.NumAtom
      WebSupergoo.ABCpdf9.Atoms.RefAtom
      WebSupergoo.ABCpdf9.Atoms.StringAtom

Implements: ICloneable, IDisposable

 

   
   
Method Description
 FromString Create an appropriate type of Atom from a raw PDF string representation.
Dispose Dispose of the Atom.
Clone Creates a deep copy of the current Atom.
Equals Test whether the two Atoms are the same.
GetHashCode A hash code for the Atom.
 GetBool Gets the Boolean value from the Atom if it is a BoolAtom.
 GetDouble Gets the double value from the Atom if it is a NumAtom.
 GetID Gets the Object ID value from the Atom if it is a RefAtom.
 GetInt Gets the integer value from the Atom if it is a NumAtom.
 GetItem Gets the specified item from the Atom if it is of a type which contains other Atoms.
 GetName Gets the Name value from the Atom if it is a NameAtom.
 GetText Gets the Text value from the Atom if it is a StringAtom.
 RemoveItem Removes the named entry from the Atom if it is a DictAtom.
 SetItem Adds a specified item to the Atom if it is of a type which contains other Atoms.
ToString The string representation of the Atom as it would appear in a PDF.

 

   
   
Property Description
none