PTObj

@interface PTObj : NSObject

Obj is a concrete class for all SDF/Cos objects. Obj hierarchy implements the composite design pattern. As a result, you can invoke a member function of any ‘derived’ object through Obj interface. If the member function is not supported (e.g. if you invoke Obj::GetNumber() on a boolean object) an Exception will be thrown.

You can use GetType() or obl.Is???() member functions to find out type-information at run time, however most of the time the type can be inferred from the PDF specification. Therefore when you call Doc::GetTrailer() you can assume that returned object is a dictionary. If there is any ambiguity use Is???() methods.

Objects can’t be shared across documents, however you can use Doc::ImportObj() to copy objects from one document to another.

Objects can be shared within a document provided that they are created as indirect. Indirect objects are the ones that are referenced in cross-reference table. To create an object as indirect use doc.CreateIndirect???() (where ? is the Object type).

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (PTObjType)GetType;

    Swift

    func getType() -> PTObjType

    Return Value

    the object type.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsBool;

    Swift

    func isBool() -> Bool

    Return Value

    true if this is a Bool object, false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsNumber;

    Swift

    func isNumber() -> Bool

    Return Value

    true if this is a Number object, false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsNull;

    Swift

    func isNull() -> Bool

    Return Value

    true if this is a Null object, false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsString;

    Swift

    func isString() -> Bool

    Return Value

    true if this is a Str (String) object, false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsName;

    Swift

    func isName() -> Bool

    Return Value

    true if this is Name, false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsIndirect;

    Swift

    func isIndirect() -> Bool

    Return Value

    true if this is Indirect object (i.e. object referenced in the cross-reference table), false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsContainer;

    Swift

    func isContainer() -> Bool

    Return Value

    true if this is a Container (a dictionary, array, or a stream), false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsDict;

    Swift

    func isDict() -> Bool

    Return Value

    true if this is a dictionary (i.e. Dict), false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsArray;

    Swift

    func isArray() -> Bool

    Return Value

    true if this is an Array, false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsStream;

    Swift

    func isStream() -> Bool

    Return Value

    true if this is a Stream, false otherwise.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (PTSDFDoc *)GetDoc;

    Swift

    func getDoc() -> PTSDFDoc!

    Return Value

    the document to which this object belongs.

  • The function writes the Obj to the output stream

    Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (void)Write:(PTFilterWriter *)stream;

    Swift

    func write(_ stream: PTFilterWriter!)

    Parameters

    stream

    - the input stream where the Obj will be written

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (unsigned long)Size;

    Swift

    func size() -> UInt

    Return Value

    the ‘size’ of the object. The definition of ‘size’ depends on the object type. In particular:

    • For a dictionary or a stream object, the method will return the number of key/value pairs in the dictionary.
    • For an array object the method will return the number of Obj entries in the array.
    • For a string object the method will return the number of bytes in the string buffer.
    • For any other object the method will always return 1.
  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (unsigned int)GetObjNum;

    Swift

    func getNum() -> UInt32

    Return Value

    object number. If this is not an Indirect object, object number of a containing indirect object is returned.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (unsigned short)GetGenNum;

    Swift

    func getGenNum() -> UInt16

    Return Value

    generation number. If this is not an Indirect object, generation number of a containing indirect object is returned.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (unsigned long)GetOffset;

    Swift

    func getOffset() -> UInt

    Return Value

    object offset from the beginning of the file. If this is not an Indirect object, offset of a containing indirect object is returned.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsFree;

    Swift

    func isFree() -> Bool

    Return Value

    true if the object is in use or is marked as free.

  • Set the object mark. Mark is a boolean value that can be associated with every indirect object. This is especially useful when an object graph should be traversed and an operation should be performed on each node only once.

    Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (void)SetMark:(BOOL)mark;

    Swift

    func setMark(_ mark: Bool)

    Parameters

    mark

    boolean value that the object’s mark should be set to.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsMarked;

    Swift

    func isMarked() -> Bool

    Return Value

    true if the object is marked.

  • Note

    this method can be invoked on any Obj.

    Declaration

    Objective-C

    - (BOOL)IsLoaded;

    Swift

    func isLoaded() -> Bool

    Return Value

    true if the object is loaded in memory.

  • Declaration

    Objective-C

    - (BOOL)IsValid;

    Swift

    func isValid() -> Bool

    Return Value

    true if this is a valid object, false otherwise. If the function returns false then the underlying SDF/Cos object is null or is not valid.

  • Declaration

    Objective-C

    - (BOOL)GetBool;

    Swift

    func getBool() -> Bool

    Return Value

    bool value if this is Bool. @exception Exception is thrown if the object is not Obj::Type::e_bool

  • Declaration

    Objective-C

    - (void)SetBool:(BOOL)b;

    Swift

    func setBool(_ b: Bool)

    Parameters

    b

    - bool value used to set Bool object. @exception An Exception is thrown if this is not a Obj::Type::e_bool

  • Declaration

    Objective-C

    - (double)GetNumber;

    Swift

    func getNumber() -> Double

    Return Value

    value, if this is Number. @exception An Exception is thrown if the object is not a Obj::Type::e_number

  • Declaration

    Objective-C

    - (void)SetNumber:(double)n;

    Swift

    func setNumber(_ n: Double)

    Parameters

    n

    - value used to set Number object. @exception An Exception is thrown if this is not a Obj::Type::e_number

  • Note

    if SDF/Cos String object is represented as ‘PDF Text’ (Section 3.8.1 ‘Text Strings’ in PDF Reference) you can use GetAsPDFText method to obtain Unicode representation of the string.

    Note

    use Size() member function in order to obtain the number of bytes in string buffer.

    @exception Exception is thrown if this is not a Obj::Type::e_string.

    Declaration

    Objective-C

    - (NSData *)GetBuffer;

    Swift

    func getBuffer() -> Data!

    Return Value

    a pointer to the string buffer. Please note that the string may not be NULL terminated and that it may not be represented in ASCII or Unicode encoding. For more information on SDF/Cos String objects, please refer to section 3.2.3 ‘String Objects’ in PDF Reference Manual.

  • Note

    Similar in behaviour to GetBuffer except that no decryption is done. If the file is not encrypted the result should be the same as GetBuffer

    @exception Exception is thrown if this is not a Obj::Type::e_string.

    Declaration

    Objective-C

    - (NSData *)GetRawBuffer;

    Swift

    func getRawBuffer() -> Data!

    Return Value

    a vector containing the encrypted string buffer.

  • Convert the SDF/Cos String object to ‘PDF Text String’ (a Unicode string).

    PDF Text Strings are not used to represent page content, however they are used in text annotations, bookmark names, article names, document information etc. These strings are encoded in either PDFDocEncoding or Unicode character encoding. For more information on PDF Text Strings, please refer to section 3.8.1 ‘Text Strings’ in PDF Reference.

    Note

    Not all SDF/Cos String objects are used to represent ‘PDF Text’. PDF Reference indicates (on a case by case basis ) where an SDF/Cos String object can be used as ‘PDF Text’.

    @exception An Exception is thrown if this is not a Obj::Type::e_string.

    Declaration

    Objective-C

    - (NSString *)GetAsPDFText;

    Swift

    func getAsPDFText() -> String!
  • Sets the string object value.

    Declaration

    Objective-C

    - (void)SetString:(NSData *)value size:(unsigned long)size;

    Swift

    func setString(_ value: Data!, size: UInt)

    Parameters

    value

    - character buffer.

    size

    - the size of character buffer. @exception An Exception is thrown if this is not a Obj::Type::e_string

  • Sets the string object value.

    Declaration

    Objective-C

    - (void)SetStringWithStr:(NSString *)str;

    Swift

    func setStringWithStr(_ str: String!)

    Parameters

    str

    - A Unicode string value. @exception An Exception is thrown if this is not a Obj::Type::e_string

  • Declaration

    Objective-C

    - (NSString *)GetName;

    Swift

    func getName() -> String!

    Return Value

    string representing the Name object. @exception An Exception is thrown if this is not a Obj::Type::e_name

  • Declaration

    Objective-C

    - (void)SetName:(NSString *)name;

    Swift

    func setName(_ name: String!)

    Parameters

    name

    - value used to set Name object. @exception An Exception is thrown if this is not a Obj::Type::e_name

  • Sample code used to traverse all entries in the dictionary:

      DictIterator itr = dict.GetDictIterator();
      while (itr.HasNext()) {
          Obj key = itr.Key();
          Obj value = itr.Value();
          // ...
          itr.Next()
       }
    

    Declaration

    Objective-C

    - (PTDictIterator *)GetDictIterator;

    Swift

    func getDictIterator() -> PTDictIterator!

    Return Value

    an iterator that addresses the first element in the dictionary. @exception An Exception is thrown if this is not a dictionary object (Dict).

  • Search the dictionary for a given key.

    Note

    A dictionary entry whose value is Obj::Null is equivalent to an absent entry. @exception Exception is thrown if this is not a dictionary or a stream

    Sample code used to search a dictionary for a given key:

      DictIterator itr = info_dict.Find("Info");
      if (itr.HasNext()) {
        Obj info = itr.Value();
        if (info.IsDict())
          info.PutString("Producer", "PDFTron PDFNet SDK");
     }
    

    Declaration

    Objective-C

    - (PTDictIterator *)Find:(NSString *)key;

    Swift

    func find(_ key: String!) -> PTDictIterator!

    Parameters

    key

    - a key to search for in the dictionary

    Return Value

    The iterator to the matching key/value pair or invalid iterator (i.e. itr.HasNext()==fase) if the if the dictionary does not contain the given key.

  • Search the dictionary for a given key.

    Note

    A dictionary entry whose value is Obj::Null is equivalent to an absent entry. @exception Exception is thrown if this is not a dictionary or a stream

    Declaration

    Objective-C

    - (PTObj *)FindObj:(NSString *)key;

    Swift

    func find(_ key: String!) -> PTObj!

    Parameters

    key

    - a key to search for in the dictionary

    Return Value

    NULL if the dictionary does not contain the specified key. Otherwise return the corresponding value.

  • Search the dictionary for a given key and throw an exception if the key is not found.

    Declaration

    Objective-C

    - (PTDictIterator *)Get:(NSString *)key;

    Swift

    func get(_ key: String!) -> PTDictIterator!

    Parameters

    key

    - a key to search for in the dictionary

    Return Value

    Obj::Null object if the value matching specified key is a Obj::Null object. otherwise return the iterator to the matching key/value pair. @exception An Exception is thrown if the dictionary does not contain the specified key. @exception An Exception is thrown if this is not a Obj::Type::e_dict or a stream.

  • Inserts a pair in the dictionary.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutName:(NSString *)key name:(NSString *)name;

    Swift

    func putName(_ key: String!, name: String!) -> PTObj!

    Parameters

    key

    The key of the value to set.

    name

    The value of the Obj::Type::e_name object to be inserted into the dictionary.

    Return Value

    A newly created name object. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    @exception An Exception is thrown if this is not a dictionary or a stream object.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutArray:(NSString *)key;

    Swift

    func putArray(_ key: String!) -> PTObj!

    Parameters

    key

    The key of the value to set.

    Return Value

    A newly created array object.

  • Inserts a pair in the dictionary.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutBool:(NSString *)key value:(BOOL)value;

    Swift

    func putBool(_ key: String!, value: Bool) -> PTObj!

    Parameters

    key

    The key of the value to set.

    value

    The value of the Obj::Type::e_bool object to be inserted into the dictionary.

    Return Value

    A newly created boolean object. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutDict:(NSString *)key;

    Swift

    func putDict(_ key: String!) -> PTObj!

    Parameters

    key

    The key of the value to set.

    Return Value

    A newly created dictionary. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutNumber:(NSString *)key value:(double)value;

    Swift

    func putNumber(_ key: String!, value: Double) -> PTObj!

    Parameters

    key

    The key of the value to set.

    value

    The value of the Obj::Type::e_number object to be inserted into the dictionary.

    Return Value

    A newly created number object. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutString:(NSString *)key value:(NSString *)value;

    Swift

    func put(_ key: String!, value: String!) -> PTObj!

    Parameters

    key

    The key of the value to set.

    value

    The value of the Obj::Type::e_string object to be inserted into the dictionary.

    Return Value

    A newly created string object. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutStringWithSize:(NSString *)key
                           value:(NSString *)value
                            size:(int)size;

    Swift

    func putString(withSize key: String!, value: String!, size: Int32) -> PTObj!

    Parameters

    key

    The key of the value to set.

    value

    The buffer used to set the value of the Obj::Type::e_string object to be inserted into the dictionary.

    size

    The number of bytes to copy from the ‘value’ buffer parameter.

    Return Value

    A newly created string object. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    Note

    PutText will create the string object as a ‘PDF Text’ object.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutText:(NSString *)key value:(NSString *)value;

    Swift

    func putText(_ key: String!, value: String!) -> PTObj!

    Parameters

    key

    The key of the value to set.

    value

    The value of the Obj::Type::e_string object to be inserted into the dictionary.

    Return Value

    A newly created string object. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    Note

    The effect of calling this method is essentially the same as dict.Erase(key) .

    Declaration

    Objective-C

    - (void)PutNull:(NSString *)key;

    Swift

    func putNull(_ key: String!)

    Parameters

    key

    The key of the value to set. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    Declaration

    Objective-C

    - (PTObj *)Put:(NSString *)key obj:(PTObj *)obj;

    Swift

    func put(_ key: String!, obj: PTObj!) -> PTObj!

    Parameters

    key

    The key of the value to set.

    obj

    The value to be inserted into the dictionary. If ‘obj’ is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then inserted into the dictionary.

    Return Value

    A newly inserted object. @exception An Exception is thrown if this is not a dictionary or a stream object.

  • Inserts a pair in the dictionary.

    @exception An Exception is thrown if this is not a dictionary or a stream object.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutRect:(NSString *)key
                    x1:(double)x1
                    y1:(double)y1
                    x2:(double)x2
                    y2:(double)y2;

    Swift

    func putRect(_ key: String!, x1: Double, y1: Double, x2: Double, y2: Double) -> PTObj!

    Parameters

    key

    The key of the value to set.

    x1

    The bottom left x value of the rect to be inserted

    y1

    The bottom left y value of the rect to be inserted

    x2

    The top right x value of the rect to be inserted

    y2

    The top right y value of the rect to be inserted

    Return Value

    A newly created array object.

  • Inserts a pair in the dictionary.

    @exception An Exception is thrown if this is not a dictionary or a stream object.

    Note

    If a dictionary already contains an entry with the same key, the old entry will be deleted and all DictIterators to this entry will be invalidated.

    Declaration

    Objective-C

    - (PTObj *)PutMatrix:(NSString *)key value:(PTMatrix2D *)value;

    Swift

    func putMatrix(_ key: String!, value: PTMatrix2D!) -> PTObj!

    Parameters

    key

    The key of the value to set.

    value

    - A matrix used to set the values in an array of six numbers. The resulting array will be inserted into the dictionary.

    Return Value

    A newly created array object.

  • Removes an element in the dictionary that matches the given key.

    Declaration

    Objective-C

    - (void)EraseDictElementWithKey:(NSString *)key;

    Swift

    func eraseDictElement(withKey key: String!)

    Parameters

    key

    A string representing the key value of the element to remove. @exception An Exception is thrown if this is not a dictionary or a stream.

  • Removes an element in the dictionary from specified position.

    Declaration

    Objective-C

    - (void)EraseDictElementWithPos:(PTDictIterator *)pos;

    Swift

    func eraseDictElement(withPos pos: PTDictIterator!)

    Parameters

    pos

    A dictionary iterator indicating the position of the element to remove. @exception An Exception is thrown if this is not a dictionary or a stream.

  • Change the key value of a dictionary entry. The key can’t be renamed if another key with the same name already exists in the dictionary. In this case Rename returns false.

    Declaration

    Objective-C

    - (BOOL)Rename:(NSString *)old_key new_key:(NSString *)new_key;

    Swift

    func rename(_ old_key: String!, new_key: String!) -> Bool

    Parameters

    old_key

    A string representing the key value to be changed.

    new_key

    A string representing the key value that the old key is changed into. @exception An Exception is thrown if this is not a dictionary or a stream.

  • @exception throws an Exception if index is outside the array bounds. @exception An Exception is thrown if this is not an Obj::Type::e_array.

    Declaration

    Objective-C

    - (PTObj *)GetAt:(unsigned long)index;

    Swift

    func getAt(_ index: UInt) -> PTObj!

    Parameters

    index

    - The array element to obtain. The first element in an array has an index of zero.

  • Inserts an Obj::Type::e_name object in the array.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertName:(unsigned long)pos name:(NSString *)name;

    Swift

    func insertName(_ pos: UInt, name: String!) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    name

    The value of the Obj::Type::e_name object to be inserted.

    Return Value

    A newly created name object.

  • Inserts an Obj::Type::e_array object in the array.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertArray:(unsigned long)pos;

    Swift

    func insertArray(_ pos: UInt) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    Return Value

    A newly created array object.

  • Inserts an Obj::Type::e_bool object in the array.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertBool:(unsigned long)pos value:(BOOL)value;

    Swift

    func insertBool(_ pos: UInt, value: Bool) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    value

    The value of the Obj::Type::e_bool object to be inserted.

    Return Value

    A newly created boolean object.

  • Inserts an Obj::Type::e_dict object in the array.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertDict:(unsigned long)pos;

    Swift

    func insertDict(_ pos: UInt) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    Return Value

    A newly created dictionary object.

  • Inserts an Obj::Type::e_number object in the array.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertNumber:(unsigned long)pos value:(double)value;

    Swift

    func insertNumber(_ pos: UInt, value: Double) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    value

    The value of the Obj::Type::e_number object to be inserted.

    Return Value

    A newly created number object.

  • Inserts an Obj::Type::e_string object in the array.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertString:(unsigned long)pos value:(NSString *)value;

    Swift

    func insertString(_ pos: UInt, value: String!) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    value

    The value of the Obj::Type::e_string object to be inserted.

    Return Value

    A newly created string object.

  • Inserts an Obj::Type::e_string object in the array.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertStringWithSize:(unsigned long)pos
                              value:(NSString *)value
                               size:(int)size;

    Swift

    func insertString(withSize pos: UInt, value: String!, size: Int32) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    value

    The buffer used to set the value of the Obj::Type::e_string object to be inserted.

    size

    The number of bytes to copy from the ‘value’ buffer parameter.

    Return Value

    A newly created string object.

  • Inserts an Obj::Type::e_string object in the array.

    Note

    InsertText will create the string object as a ‘PDF Text’ object. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)InsertText:(unsigned long)pos value:(NSString *)value;

    Swift

    func insertText(_ pos: UInt, value: String!) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    value

    The value of the Obj::Type::e_string object to be inserted.

    Return Value

    A newly created string object.

  • Inserts an Obj::Type::e_null object in the array.

    Declaration

    Objective-C

    - (PTObj *)InsertNull:(unsigned long)pos;

    Swift

    func insertNull(_ pos: UInt) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Return Value

    A newly created null object.

  • Inserts an existing Obj in this array.

    Declaration

    Objective-C

    - (PTObj *)Insert:(unsigned long)pos obj:(PTObj *)obj;

    Swift

    func insert(_ pos: UInt, obj: PTObj!) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    obj

    The value to be inserted into the dictionary. If ‘obj’ is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then inserted.

    Return Value

    A newly inserted object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Inserts an array of 4 numbers in this array.

    Declaration

    Objective-C

    - (PTObj *)InsertRect:(unsigned long)pos
                       x1:(double)x1
                       y1:(double)y1
                       x2:(double)x2
                       y2:(double)y2;

    Swift

    func insertRect(_ pos: UInt, x1: Double, y1: Double, x2: Double, y2: Double) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    x1

    The bottom left x value of the rect to be inserted

    y1

    The bottom left y value of the rect to be inserted

    x2

    The top right x value of the rect to be inserted

    y2

    The top right y value of the rect to be inserted

    Return Value

    A newly created array object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Inserts an array of 6 numbers in this array.

    Declaration

    Objective-C

    - (PTObj *)InsertMatrix:(unsigned long)pos value:(PTMatrix2D *)value;

    Swift

    func insertMatrix(_ pos: UInt, value: PTMatrix2D!) -> PTObj!

    Parameters

    pos

    - The location in the array to insert the object . The object is inserted before the specified location. The first element in an array has a pos of zero. If pos >= Array->Length(), appends obj to array.

    value

    - A matrix used to set the values in an array of six numbers. The resulting array will be then inserted in this array.

    Return Value

    A newly created array object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Appends a new Obj::Type::e_name object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackName:(NSString *)name;

    Swift

    func pushBackName(_ name: String!) -> PTObj!

    Parameters

    name

    - The value of the Obj::Type::e_name object. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Return Value

    The new array object.

  • Appends a new Obj::Type::e_array object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackArray;

    Swift

    func pushBackArray() -> PTObj!

    Return Value

    The new array object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Appends a new Obj::Type::e_bool object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackBool:(BOOL)value;

    Swift

    func pushBack(_ value: Bool) -> PTObj!

    Parameters

    name

    - The value of the Obj::Type::e_bool object. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Return Value

    The new boolean object.

  • Appends a new Obj::Type::e_dict object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackDict;

    Swift

    func pushBackDict() -> PTObj!

    Return Value

    The new dictionary object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Appends a new Obj::Type::e_number object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackNumber:(double)value;

    Swift

    func pushBackNumber(_ value: Double) -> PTObj!

    Parameters

    value

    - The value of the Obj::Type::e_number object. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Return Value

    The new number object.

  • Appends a new Obj::Type::e_string object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackString:(NSString *)value;

    Swift

    func pushBack(_ value: String!) -> PTObj!

    Parameters

    value

    - The value of the Obj::Type::e_string object. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Return Value

    The new string object.

  • Appends a new Obj::Type::e_string object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackStringWithSize:(NSString *)value size:(int)size;

    Swift

    func pushBackString(withSize value: String!, size: Int32) -> PTObj!

    Parameters

    value

    The buffer used to set the value of the Obj::Type::e_string object to be inserted.

    size

    The number of bytes to copy from the ‘value’ buffer parameter. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Return Value

    The new string object.

  • Appends a new Obj::Type::e_string object at the end of the array.

    Note

    InsertText will create the string object as a ‘PDF Text’ object. @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (PTObj *)PushBackText:(NSString *)value;

    Swift

    func pushBackText(_ value: String!) -> PTObj!

    Parameters

    value

    The value of the Obj::Type::e_string object to be inserted.

    Return Value

    The new string object.

  • Appends a new Obj::Type::e_null object at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackNull;

    Swift

    func pushBackNull() -> PTObj!

    Return Value

    The new null object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Appends an existing Obj at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBack:(PTObj *)obj;

    Swift

    func pushBack(_ obj: PTObj!) -> PTObj!

    Parameters

    obj

    The value to be inserted into the dictionary. If ‘obj’ is indirect (i.e. is a shared) object it will be inserted by reference, otherwise the object will be cloned and then appended.

    Return Value

    A newly appended object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Appends an array of 4 numbers at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackRect:(double)x1 y1:(double)y1 x2:(double)x2 y2:(double)y2;

    Swift

    func pushBackRect(_ x1: Double, y1: Double, x2: Double, y2: Double) -> PTObj!

    Parameters

    x1

    The bottom left x value of the rect to be inserted

    y1

    The bottom left y value of the rect to be inserted

    x2

    The top right x value of the rect to be inserted

    y2

    The top right y value of the rect to be inserted

    Return Value

    A newly appended array object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Appends an array of 6 numbers at the end of the array.

    Declaration

    Objective-C

    - (PTObj *)PushBackMatrix:(PTMatrix2D *)value;

    Swift

    func pushBack(_ value: PTMatrix2D!) -> PTObj!

    Parameters

    value

    - A matrix used to set the values in an array of six numbers. The resulting array will be then inserted in this array.

    Return Value

    A newly appended array object. @exception An Exception is thrown if this is not an Obj::Type::e_array

  • Checks whether the position is within the array bounds and then removes it from the array and moves each subsequent element to the slot with the next smaller index and decrements the arrays length by 1.

    @exception An Exception is thrown if this is not an Obj::Type::e_array

    Declaration

    Objective-C

    - (void)EraseAt:(unsigned long)pos;

    Swift

    func erase(at pos: UInt)

    Parameters

    pos

    The index for the array member to remove. Array indexes start at 0.

  • Declaration

    Objective-C

    - (unsigned long)GetRawStreamLength;

    Swift

    func getRawStreamLength() -> UInt

    Return Value

    the length of the raw/encoded stream equal to the Length parameter @exception An Exception is thrown if this is not a Obj::Type::e_stream

  • Declaration

    Objective-C

    - (PTFilter *)GetRawStream:(BOOL)decrypt;

    Swift

    func getRawStream(_ decrypt: Bool) -> PTFilter!

    Parameters

    decrypt

    - If true decrypt the stream if the stream is encrypted.

    Return Value

    - A filter to the encoded stream @exception An Exception is thrown if this is not a Obj::Type::e_stream

  • Declaration

    Objective-C

    - (PTFilter *)GetDecodedStream;

    Swift

    func getDecodedStream() -> PTFilter!

    Return Value

    - A filter to the decoded stream @exception An Exception is thrown if this is not a Obj::Type::e_stream

  • allows to replace the content stream with a new one without creating a new object

    Declaration

    Objective-C

    - (void)SetStreamData:(NSString *)data
                data_size:(unsigned long)data_size
             filter_chain:(PTFilter *)filter_chain;

    Swift

    func setStreamData(_ data: String!, data_size: UInt, filter_chain: PTFilter!)
  • Declaration

    Objective-C

    - (BOOL)IsEqual:(PTObj *)to;

    Swift

    func isEqual(_ to: PTObj!) -> Bool

    Parameters

    to

    - Obj to compare to

    Return Value

    true if two Obj’s point to the same object. This method does not compare object content. For this operation use IsEqualValue() instead.

  • Undocumented

    Declaration

    Objective-C

    - (BOOL)isEqualTo: (PTObj*)to;

    Swift

    func isEqual(to: PTObj!) -> Bool
  • Undocumented

    Declaration

    Objective-C

    + (PTObj*)CreateInternal: (unsigned long long)impl;

    Swift

    class func createInternal(_ impl: UInt64) -> PTObj!
  • Undocumented

    Declaration

    Objective-C

    - (unsigned long long)GetHandleInternal;

    Swift

    func getHandleInternal() -> UInt64
  • Undocumented

    Declaration

    Objective-C

    - (instancetype)init;

    Swift

    init!()