# Object tree, Stream, Selection and Property editor

The right side of PdfEditor consists of two main parts Object tree and Property editor. It can be further specialized to Selection and Stream windows.

Pdf file consists of objects which form a tree-like structure. There are seven simple objects

- null

- boolean

- integer

- real

- string

- name

- reference

and three complex

- array

- dictionary

- stream

Object tree displays the tree-like object hierarchy starting at the most important objects and Property editor displays the contents of selected object in human readable form and allows editing the objects in raw form.

There is one important object called content stream which consists of many small operators and their operands. Everything visible on a page is in these content streams. Pdf operators are the objects that contorl what is displayed on a page. The content stream is shown in Stream window in human editable form.

Last tool used to display objects is the Selection window. When some operators are selected using selection modes, those operators are displayed in the Selection window.

Object tree, Stream, Selection and Property editor

## Purpose and usage

The purpose of these windows is to enable complete control over pdf objects and structure of a pdf file. It shows raw pdf objects in user friendly way with the possibility to traverse the objects using the tree like structure, select special category of operators and perform operation on resulting set, see exactly which operators were selected using graphical selection tools. It also allows editing raw objects which mostly requires knowledge of the pdf standard.

We gain complete control over pdf file with this tool. It can be used for advanced editing that almost makes PdfEditor a pdf creator. With the description of operators, object type highlighting and object importance visualization this tool can be also used by normal users for simple but powerful editions. We can add and delete objects almost at will (some top level objects are just for more human readibility and can be neither deleted nor added.)

## Object tree start objects

There are three main objects in the object tree.

- Catalog

- Pages

- Outlines

Catalog object is the start point of all objects. Any object can be reached from Catalog. Pages and Outlines are just shortcuts for special objects somewhere deep in Catalog object.

### Catalog

Root object of all objects.

Catalog

### Pages

Set of all pages and it is a shortcut to all page dictionaries.

Pages

### Outlines

List of all outlines with the ability to edit the title.

Outlines

## Adding and deleting objects

This feature is for very advanced users. Object tree can be used to to add and delete objects, stream and selection to delete objects. User can choose the type of object which to add. Deletion of pdf operator operands is not allowed because in most cases the result would be an invalid content stream.

### Creating pdf files

The adding object feature can be used to create completely new pdf files. With the help of scripting, PdfEditor can be used as pdf creator. The advantage is that we can use arbitrary empty template pdf file created by any drawing tool and PdfEditor to add objects into it. The creation of pdf files containing text is limited because we do not support our own fonts only standard ones.

## Controls

There are two ways how to to open, close and select objects. We can use either mouse or arrows. Up/down is used to go one object above/below current and right/left is used to open/close complex objects.

When an object is selected right mouse click opens a menu with operations we can perform on the object according to its type.

Mouse right click menu

We can add properties/objects using Insert key or clicking

Add button

button and delete properties/objects pressing Delete key or clicking

Delete button

button. Not always is adding and deleting possible.

## Multiselect

We can use multiselect to select more objects and to perform specific action on all of them. We can use this feature in all mentioned tools (Object tree, Selection, Stream). This can dramatically increase speed of editing.

Multiselect

## Object tree

There are many special objects. You can specify which of them to display and which not. And whether crucial objects should be locked to changes. In menu click Tools->Options and select Editor tab. In order to take effect reload the object tree.

Editor options

In menu click Tools->Options and select Object tree tab. In order to take effect reload the object tree.

Object tree display options

### Property mode

Many pdf objects are compulsory or must contain required entries or have specified values. Incompetent manipulation with these objects can result in invalid pdf files or non predictable output. Therefore a mode is assigned to every property which indicates the importance of the property. There are

- Unknown - mode not known

- Normal - normal property, editing should not harm

- Hidden - not crucial property, editing should not harm

- Read only - not property, manual editing does not make sense

- Advanced - crucial property, incompetent editing can make harm

When mouse cursor is over a property the property mode is displayed as text in the status bar. Hidden, read only and advanced tincture property colour to blue, gray and red. It depends on the theme used.

Visualization of object mode

These settings are stored in mode.conf file which can be easily modified to match user own pdf skills.

### Adding and deleting properties

Adding and deleting objects in the object tree is possible. There are two keyboard shortcuts for this, Insert of adding, Delete for deleting

## Property editor

### Editing properties

Each pdf object has simple value or set of values which can be changed. Almost all pdf operators have operands which are normal pdf objects which can be changed. Implicit changing of object types is not allowed (e.g. integer object to string etc.) but this can be done by deleting and adding desired property type. When changing integer object only integers are accepted, when changing boolean values only true/false is accepted etc.

Editing a property

When editing a reference number a dialog appears which verifies whether a pdf object with specified reference number exists.

Text selection

To make a change visible perform these steps

- edit the object value

- press enter or click away from the property

- reload page if the change is visible

## Selection

PdfEditor allows selecting specific operators easily using selection modes. There are two main object selection modes namely text selection and graphical object selection. The third way how to select objects is using multiselect which allows us to manually select more objects. Selection is very useful when performing an action on many objects (e.g. deleting...)

### Text selection

When this mode is selected we can select only text objects.

Text selection

Note: TrueType fonts use pictures to draw letters and that makes it very difficult to compute the height of the letter. The height of a true type letter can be incorrect.

### Graphical objects selection

When this mode is selected we can select only graphical objects. Many pdf creators are putting strange invisible graphical objects to page so sometimes it is difficult to select the right graphical object.

Graphical object selection

### Deleting objects

Press Delete key to delete selected objects.

## Stream

Page is drawn by executing operations which are equal to small changes. These changes are stored in content stream of a page. You can display these operations by clicking Pages->Page #->Stream # in Object tree. New tab is displayed which shows pdf operators and their operands.

Stream

### Operator description

As mentioned above, operators control what is displayed on a page. For advanced editing, it is crucial to be able to change them. For non advanced users the operator tags are not very intuitive so a human description of each operator is shown in the status bar.

Operator description

The definition of the operators is stored in operator.hint and can be edited freely.

### Operator modes

There many operators but only few worth changing manually. To allow fast search of these operators, operator modes were designed. After selecting one of the operator modes in Stream window, only those operators are shown. Currently there are four operator modes

- operators

- text operators

- font operators

- graphical objects iterators

Operator modes

### Adding and deleting properties

Only deleting is possible.