OperatorCollection

Inheritance: java.lang.Object, com.aspose.pdf.BaseOperatorCollection

public class OperatorCollection extends BaseOperatorCollection

Class represents collection of operators

Constructors

ConstructorDescription
OperatorCollection(IPdfPrimitive contents)For internal usage only!

Methods

MethodDescription
isReadOnly()Gets a value indicating whether the collection is read-only.
isCommandsParsed()Gets commands parsed
updateNormalizedData()Update object stream with fixing absent GSave/GRestore operators.
updateData()Update object stream.
size()Gets count of operators in the collection.
precalculateOperatorsCount()Get amount of operators that describe content for the page without initialisation of them.
isFastTextExtractionMode()Indicates wheather collection is limited to fast text extraction
iterator()Returns enumerator for collection
accept(IOperatorSelector visitor)Accepts IOperatorSelector visitor object to process operators.
add(Operator op)Adds new operator into collection.
delete(int index)Deletes operator from collection.
deleteUnrestricted(int index)internal unrestricted version of Delete(index)
insert(int index, Operator op)Inserts operator into collection.
replace(Iterable operators)Replace operators in collection with other operators.
replace(Operator[] operators)Replace operators in collection with other operators.
add(Operator[] ops)Add operators at the end of the contents operators.
insert(int at, Operator[] ops)Insert operators at the the given position.
get_Item(int index)Gets operator by its index.
set_Item(int index, Operator value)Sets operator by its index.
getUnrestricted(int index)Internal unrestricted version of indexer
delete(Operator[] ops)Deletes operators from collection.
delete(Iterable list)Deletes operators from collection.
insert(int at, Iterable ops)Insert operators at the the given position.
clear()Removes all operators from list.
toString()Returns text representation of the operator.
add(Iterable ops)Adds to collection all operators from other collection.
isBracketed()Gets bracketed status of operator sequence i.e.
suppressUpdate()Suppresses update contents data The contents stream is not updated until ResumeUpdate is called
resumeUpdate(boolean updateAll)Resumes document update.
resumeUpdate()Resumes document update.
cancelUpdate()Cancels last update.
toList()Returns operator list.
remove(Operator op)Remove operator from the collection.
contains(Operator op)Returns true if the collection contains given operator.

OperatorCollection(IPdfPrimitive contents)

public OperatorCollection(IPdfPrimitive contents)

For internal usage only!

Constructor of OperatorCollection. Constructs operators from primitive contains operators list.

Parameters:

ParameterTypeDescription
contentsIPdfPrimitiveIPdfPrimitive object

isReadOnly()

public boolean isReadOnly()

Gets a value indicating whether the collection is read-only.

Returns: boolean - boolean value

isCommandsParsed()

public boolean isCommandsParsed()

Gets commands parsed

Returns: boolean - boolean value

updateNormalizedData()

public void updateNormalizedData()

Update object stream with fixing absent GSave/GRestore operators.

updateData()

public void updateData()

Update object stream.

size()

public int size()

Gets count of operators in the collection.

Returns: int - int value

precalculateOperatorsCount()

public int precalculateOperatorsCount()

Get amount of operators that describe content for the page without initialisation of them.

Returns: int - int value

isFastTextExtractionMode()

public boolean isFastTextExtractionMode()

Indicates wheather collection is limited to fast text extraction

Returns: boolean - boolean value

iterator()

public System.Collections.Generic.IGenericEnumerator<Operator> iterator()

Returns enumerator for collection

Returns: com.aspose.ms.System.Collections.Generic.IGenericEnumerator<com.aspose.pdf.Operator> - Collection enumerator

accept(IOperatorSelector visitor)

public void accept(IOperatorSelector visitor)

Accepts IOperatorSelector visitor object to process operators.

Parameters:

ParameterTypeDescription
visitorIOperatorSelectorVisitor object

add(Operator op)

public void add(Operator op)

Adds new operator into collection.


Example demonstrates how to add operators to the end of page.contents.

Document doc = new Document(“input.pdf”); doc.getPages().get(1).getContents().add(new com.aspose.pdf.operators.q()); doc.getPages().get(1).getContents().add(new com.aspose.pdf.operators.Q());

Parameters:

ParameterTypeDescription
opOperatorOperator which must be added

delete(int index)

public void delete(int index)

Deletes operator from collection.


Example demonstrates how to delete operator by its index.

Document doc = new Document(“input.pdf”); OperatorCollection oc = doc.getPages(1).getContents(); oc.delete(3);

Parameters:

ParameterTypeDescription
indexintIndex of operator which must be deleted. Operators numbering starts from 1.

deleteUnrestricted(int index)

public void deleteUnrestricted(int index)

internal unrestricted version of Delete(index)

Parameters:

ParameterTypeDescription
indexintint value

insert(int index, Operator op)

public void insert(int index, Operator op)

Inserts operator into collection.


Example demonstrates how to insert operator to the page contents.

Document doc = new Document(“input.pdf”); OperatorCollection oc = doc.getPages(1).getContents(); oc.insert(1, new com.aspose.pdf.operators.q()); oc.add(new com.aspose.pdf.operators.Q());

Parameters:

ParameterTypeDescription
indexintIndex where new operator must be added
opOperatorOperator which will be inserted

replace(Iterable operators)

public void replace(Iterable<Operator> operators)

Replace operators in collection with other operators.

Parameters:

ParameterTypeDescription
operatorsjava.lang.Iterable<com.aspose.pdf.Operator>Operators list which will replace operators currently contained in the collection. Each operator from the list must have correct index in range [1..N] where N is count of operators in the collection

replace(Operator[] operators)

public void replace(Operator[] operators)

Replace operators in collection with other operators.

Parameters:

ParameterTypeDescription
operatorsOperator[]Operator[] array which will replace operators currently contained in the collection. Each operator from the list must have correct index in range [1..N] where N is count of operators in the collection

add(Operator[] ops)

public void add(Operator[] ops)

Add operators at the end of the contents operators.


Example demonstrates how to add operator to the end of page contents.

Document doc = new Document(“input.pdf”); OperatorCollection oc = doc.getPages().get(1).getContents(); oc.add(new Operator[] { new com.aspose.pdf.operators.q(), new com.aspose.pdf.operators.Q() } );

Parameters:

ParameterTypeDescription
opsOperator[]Array of operators to be added. Each operator can have any index (by default -1) because they come to the end of the contents operators i.e. indices are assigned automatically.

insert(int at, Operator[] ops)

public void insert(int at, Operator[] ops)

Insert operators at the the given position.


Example demonstrates how to insert operator to the page contents.

Document doc = new Document(“input.pdf”); OperatorCollection oc = doc.getPages().get(1).getContents(); oc.insert(1, new Operator[] { new com.aspose.pdf.operators.q(), new com.aspose.pdf.operators.Q() } );

Parameters:

ParameterTypeDescription
atintIndex from which operators are being started to insert.
opsOperator[]Array of operators to be inserted. Each operator can have any index (by default -1) because their indices adjusted automatically starting from at .

get_Item(int index)

public Operator get_Item(int index)

Gets operator by its index.


Example demonstrates how to get operator of page contents by index.

Document doc = new Document("input.pdf");
 OperatorCollection oc = doc.getPages().get(1).getContents();
 Operator first = oc.get_Item(1);

Parameters:

ParameterTypeDescription
indexintIndex of operator. Numbering is starts from 1.

Returns: Operator - Operator from requested index

set_Item(int index, Operator value)

public void set_Item(int index, Operator value)

Sets operator by its index.

Parameters:

ParameterTypeDescription
indexintint value
valueOperatorOperator object

getUnrestricted(int index)

public Operator getUnrestricted(int index)

Internal unrestricted version of indexer

Parameters:

ParameterTypeDescription
indexintint value

Returns: Operator - Operator object

delete(Operator[] ops)

public void delete(Operator[] ops)

Deletes operators from collection.


Example demonstrates how to remove operator from page contents.

Document doc = new Document(“input.pdf”); OperatorCollection oc = doc.getPages().get(1).getContents(); oc.delete(new Operator[] { oc[1] } );

Parameters:

ParameterTypeDescription
opsOperator[]Array of operators to delete

delete(Iterable list)

public void delete(Iterable<Operator> list)

Deletes operators from collection.


Example demonstrates how to remove operator from page contents.

Document doc = new Document(“input.pdf”); OperatorCollection oc = doc.getPages().get(1).getContents(); ArrayList opList = new ArrayList(); opList.add(oc[1]); oc.delete(opList);

Parameters:

ParameterTypeDescription
listjava.lang.Iterable<com.aspose.pdf.Operator>The list of operators to delete

insert(int at, Iterable ops)

public void insert(int at, Iterable<Operator> ops)

Insert operators at the the given position.


Example demonstrates how to insert operators to page contents.

Document doc = new Document(“input.pdf”); OperatorCollection oc = doc.getPages().get(1).getContents(); ArrayList opList = new List(); opList.add(new com.aspose.pdf.operators.q()); opList.add(new com.aspose.pdf.operators.Q()); oc.insert(1, opList);

Parameters:

ParameterTypeDescription
atintIndex from which operators are being started to insert.
opsjava.lang.Iterable<com.aspose.pdf.Operator>Array of operators to be inserted.

clear()

public void clear()

Removes all operators from list.


Example demonstrates how to clear page contents.

Document doc = new Document(“input.pdf”); doc.getPages().get(1).clear();

toString()

public String toString()

Returns text representation of the operator.

Returns: java.lang.String - Text representation of operator.

add(Iterable ops)

public void add(Iterable<Operator> ops)

Adds to collection all operators from other collection.


Example demonstrates how to add operator collection to the page contents.

 Document doc = new Document("input.pdf");
 OperatorCollection oc = doc.getPages(1).getContents();
 ArrayList opList = new ArrayList();
 opList.add(new com.aspose.pdf.operators.q());
 opList.add(new com.aspose.pdf.operators.Q());
 oc.add(opList);

Parameters:

ParameterTypeDescription
opsjava.lang.Iterable<com.aspose.pdf.Operator>collection which contains operators which will be added.

isBracketed()

public boolean isBracketed()

Gets bracketed status of operator sequence i.e. is this operators are inside of q - Q blocks

Returns: boolean - boolean value

suppressUpdate()

public void suppressUpdate()

Suppresses update contents data The contents stream is not updated until ResumeUpdate is called

resumeUpdate(boolean updateAll)

public final void resumeUpdate(boolean updateAll)

Resumes document update. Updates contents stream in case there are any pending changes. Marks all operators as “changed” if invalidate parameter is true.

Parameters:

ParameterTypeDescription
updateAllbooleanIf true, all operators in the collection marked as updated.

resumeUpdate()

public void resumeUpdate()

Resumes document update. Updates contents stream in case there are any pending changes.

cancelUpdate()

public void cancelUpdate()

Cancels last update. This method may be called when the change should not raise contents update.

toList()

public System.Collections.Generic.List<Operator> toList()

Returns operator list.

Returns: com.aspose.ms.System.Collections.Generic.List<com.aspose.pdf.Operator> - operator list.

remove(Operator op)

public boolean remove(Operator op)

Remove operator from the collection.

Parameters:

ParameterTypeDescription
opOperatorOperator to be removed.

Returns: boolean - True if operator was found and removed. False if operator did not belong to the collection.

contains(Operator op)

public boolean contains(Operator op)

Returns true if the collection contains given operator.

Parameters:

ParameterTypeDescription
opOperatorOperator instance

Returns: boolean - boolean value True - if operator found; otherwise, false.