ONLYOFFICE Docs 8.1 for developers: full-featured PDF Editor, Slide Master, improved RTL, API updates
Tags: onlyoffice, opensource, api, update
Published: 2024-07-01 15:09:11

The latest version of ONLYOFFICE Docs for developers is already available with lots of new features and API enhancements.

## ONLYOFFICE Docs Developer Edition v.8.1

### PDF Editor 

- Text editing
- Work with pages (adding, rotating, deleting)
- Inserting various objects (tables, shapes, images, etc.)
- Creating forms in PDF
- Switching between the editing and viewing modes

### Document editor

- Support for Page Color 
- Page numbering format
- Switching between the editing, reviewing, and viewing modes 

### Spreadsheet editor

- Restricting viewing of cells in the protected range
- Highlighting changed cells in the Version History
- GETPIVOTDATA and IMPORTRANGE functions
- Tips for inserting custom functions
- Support for Bengali and Sinhala 

### Presentation editor

- Slide Master 
- Animation pane

### More enhancements 

- Improved RTL support
- Shadow settings for shapes
- Extended set of color schemes
- Usability improvements

Detailed changelog can be found on [GitHub](https://github.com/ONLYOFFICE/DocumentServer/blob/master/CHANGELOG.md#810).

{% embed https://www.youtube.com/watch?v=oYlRfQ2zhaQ %}

## PDF forms

Starting from version 8.1, we completely switched to PDF forms. To create and edit a form, users don’t need other formats anymore. This means that the _docxf_ format previously used for building form templates is now deprecated.

In this regard, please check the following API updates:

- [documentType](https://api.onlyoffice.com/editors/config/#documentType) of the _docxf_ and _oform_ formats is changed to _pdf_;
- [pdf field](https://api.onlyoffice.com/editors/conversionapi#pdf) is added to the conversion request;
- [formsubmit](https://api.onlyoffice.com/editors/wopi/discovery#formsubmit) action is added to the WOPI discovery;
- the [docs_api_config](https://api.onlyoffice.com/editors/wopi/hostpage#docs_api_config) parameter is added to the form element of the WOPI host page.

## Form submission

The newly added [onSubmit](https://api.onlyoffice.com/editors/config/events#onSubmit) event is called when the form is successfully submitted. It can make the form submission action more intuitive for users.

In the code sample below, once the form is successfully submitted, a message is printed to the console. For example, you can display something like a hint for users _“Your form was successfully submitted”._

```
var onSubmit = function (event) {
    console.log("The form was submitted.");
};
var docEditor = new DocsAPI.DocEditor("placeholder", {
    "events": {
        "onSubmit": onSubmit,
        ...
    },
    ...
});
```

## Recipient roles management

By default, the Manage Roles feature is enabled, providing you with the flexibility to assign roles and colors as needed. If you find that recipient roles and the associated role-matching colors are not essential for your forms, you have the option to disable this feature.

To do so, use the _roles_ field added to the [editorConfig.customization.features](https://api.onlyoffice.com/editors/config/editor/customization#features) parameter. It defines if the role settings will be disabled in PDF forms or not. If the parameter is set to false, then the role manager is hidden and viewing the form on behalf of a specific role is disabled. In this case, the **Manage Roles** and **View Form** buttons on the Forms tab and a drop-down list for setting the field role in the right panel will not be displayed.

## Extended Automation API

[Automation API](https://api.onlyoffice.com/editors/connector) which makes it possible to interact with files form the outside features several new methods:

- `addContextMenuItem` – to add an item to the context menu;
- `addToolbarMenuItem` – to add an item to the toolbar menu;
- `updateContextMenuItem` – to update an item in the context menu with the specified items.

For example, if you want to update the context menu items, use the _updateContextMenuItem_ method. Here, pass an array with new items as an argument, specifying all the necessary parameters for each item. In the code sample below, we are passing an element with the “onConvert” ID and the “Convert to Markdown or HTML” text.

```
var items: [
    {
        "id": "onConvert",
        "text": getMessage("Convert to Markdown or HTML")
    }
]
connector.updateContextMenuItem(items);
```

_Please note: Automation API is included in the [30-day trial](https://www.onlyoffice.com/download-docs.aspx#docs-developer) of ONLYOFFICE Docs Developer, so you can try it for free. If you are planning to use Automation API for production, you will need to obtain a license with this option included._

## Customization

The **visible** field of the [editorConfig.customization.logo](https://api.onlyoffice.com/editors/config/editor/customization#logo) parameter shows or hides the logo (image file at the top left corner of the editor header). Besides, it is now also available for the mobile editors.

![editorConfig.customization.logo](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wqyrf54xawsj1ia2rmra.jpg)

## Shard key for a reliable cluster

The [WOPISrc](https://api.onlyoffice.com/editors/wopi/#wopisrc) query parameter introduced in the previous version is added to the requests from the browser to the server. This allows you to create several independent instances of ONLYOFFICE. Load balancing requests with WOPISrc ensure that collaborative editing works correctly: all users editing the same document are served by the same server. For WOPI, the parameter sent by the integrator is used. For Docs API, the new Shard key parameter is used.

The [shardkey](https://api.onlyoffice.com/editors/howitworks#shardkey) parameter is added to the URL _QueryString_ when sending requests to the **Document Command Service, Document Conversion Service,** or **Document Builder Service**. The _key_ field is used as a value. For example, _?shardkey=Khirz6zTPdfd7_. If there is no key in the body, you do not have to send it (for example, in the [getForgottenList](https://api.onlyoffice.com/editors/command/getforgottenlist) command).

## Further API updates for the editors

- The [-10 error code](https://api.onlyoffice.com/editors/conversionapi#error-codes) (size limit exceeded) is added to the Conversion API.
- The default value of the [editorConfig.customization.hideRightMenu](https://api.onlyoffice.com/editors/config/editor/customization#hideRightMenu) parameter is changed to true (i.e. the right menu will be hidden on first loading).
- The `editorConfig.customization.layout.toolbar.home.mailmerge` field is deprecated, please use the `editorConfig.customization.layout.toolbar.collaboration.mailmerge` field instead (since the Mail merge button is moved to the Collaboration tab).
- The [editorConfig.customization.goback.requestClose](https://api.onlyoffice.com/editors/config/editor/customization#goback) field is deprecated, please use the [editorConfig.customization.close](https://api.onlyoffice.com/editors/config/editor/customization#close) field instead.

## API enhancements for plugins

Starting from version 8.1, plugins can change the toolbar: create their own tabs and fill them, add buttons to the standard tabs. To do so, use the [AddToolbarMenuItem](https://api.onlyoffice.com/plugin/executemethod/common/addtoolbarmenuitem) method.

```
var oToolbarMenuItem = {
    "id": "MeaningItem",
    "type": "button",
    "text": "Meaning",
    "hint": "Meaning",
    "icons": "resources/light/icon.png",
    "disabled": false,
    "enableToggle": false,
    "lockInViewMode": false,
    "separator": true,
    "split": true,
    "items": [
        {
            "id": "onMeaningT",
            "text": "Explain text in comment"
        },
        {
            "id": "onFixSpelling",
            "text": "Fix spelling &amp; grammar"
        },
        {
            "id": "onMakeLonger",
            "text": "Make longer"
        },
        {
            "id": "onMakeShorter",
            "text": "Make shorter"
        }
    ]
};
var oToolbarMenuTab = {
    "id": "ChatGPT",
    "text": "AI Assistant",
    "items": [oToolbarMenuItem]
};
var oToolbarMenuMainItem = {
    "guid": "asc.{9DC93CDB-B576-4F0C-B55E-FCC9C48DD007}",
    "tabs": [oToolbarMenuTab]
};
window.Asc.plugin.executeMethod ("AddToolbarMenuItem", [[oToolbarMenuMainItem]]);
```

Besides, plugins can now create not only multiple windows, but also multiple left panels. The `variations.menu` parameter specifies where the plugin will be placed – on the right or left panel.

![variations.menu](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/636sqont8kf3pdzwue7k.png)

Among the new plugin methods you will find:

- [onToolbarMenuClick](https://api.onlyoffice.com/plugin/events/ontoolbarmenuclick)
- [ActivateWindow](https://api.onlyoffice.com/plugin/executemethod/common/activatewindow)
- [GetSelectedOleObjects](https://api.onlyoffice.com/plugin/executemethod/common/getselectedoleobjects)
- [GetAllComments](https://api.onlyoffice.com/plugin/executemethod/cell/getallcomments)
- and others

Check the [full list](https://api.onlyoffice.com/plugin/changelog#81) of the plugin API updates.

## Python Framework for Document Builder

For ONLYOFFICE Document Builder, there is now a [Python Builder Framework](https://api.onlyoffice.com/docbuilder/integrationapi/python) available. It contains a collection of libraries, classes, and functions that make it much easier to quickly develop applications in Python that feature document creation abilities.

## Office API

For your convenience and easier navigation, we moved the JavaScript library for working with the editors into a separate section – [Office JavaScript API](https://api.onlyoffice.com/officeapi/basic).

Here, we also added numerous new methods for the version 8.1, including those for:

- date forms;
- setting text properties;
- protected ranges;
- pasting/cutting ranges;
- reference styles;
- worksheet function;
- custom function;
- moving a cursor.

Check the [full list](https://api.onlyoffice.com/officeapi/changelog) of new methods.

## Useful links

- [What’s new in ONLYOFFICE Docs 8.1](https://www.onlyoffice.com/blog/2024/06/onlyoffice-docs-8-1-released)
- [ONLYOFFICE for developers](https://www.onlyoffice.com/developer-edition.aspx)
- [API changelog](https://api.onlyoffice.com/editors/changelog)
- [Get ONLYOFFICE Docs Developer Edition](https://www.onlyoffice.com/download-docs.aspx#docs-developer)