ONLYOFFICE Docs 8.0 for developers: PDF forms, bidirectional text, API & Doc Builder updates, and more
Tags: onlyoffice, update, opensource, api
Published: 2024-02-05 14:45:40

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.0

- Fillable PDF forms
- Bidirectional text & RTL interface
- Enhanced Screen Readers
- Goal Seek, Chart Wizard, Series in sheets
- Setting the final color for the color changing effects in slides
- Serbian and Arabic localization
- Updated UI for plugins

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

{% embed https://youtu.be/AKX3EHWojpk %}

## PDF support

We added the _pdf_ document type to the [documentType](https://api.onlyoffice.com/editors/config/#documentType) parameter. This means that PDF files*, including those containing fillable fields, are now fully supported and can be opened for annotating and filling in ONLYOFFICE PDF Editor (earlier such files were recognized as documents and opened in the document editor).

```
var docEditor = new DocsAPI.DocEditor("placeholder", {     
    "documentType": "pdf",
```
_*Also DjVu, OXPS and XPS_

## API for working with forms

The [formsdataurl](https://api.onlyoffice.com/editors/callback#formsdataurl) parameter added to the _Callback handler_ allows defining the URL to the JSON file with the submitted form data. This file contains the following parameters:

- key
- tag
- value
- type (_text, checkBox, picture, comboBox, dropDownList, dateTime, radio_)

Moreover, you will find new form methods in the DocBuilder API:

- [ApiDocument/GetFormsData](https://api.onlyoffice.com/docbuilder/textdocumentapi/apidocument/getformsdata) which returns the data from all forms present in the current document;
- [ApiDocument/SetFormsData](https://api.onlyoffice.com/docbuilder/textdocumentapi/apidocument/setformsdata) which sets the data to the specified forms.

```
builder.CreateFile("docx"); 
var oDocument = Api.GetDocument(); 
var oParagraph1 = oDocument.GetElement(0); 
var oCheckBox = Api.CreateCheckBoxForm({"key": "BestCompany"}); 
oParagraph1.Push(oCheckBox); 
var oTextForm = Api.CreateTextForm({"key": "CompanyName"}); 
oParagraph1.Push(oTextForm); 
oDocument.SetFormsData([    
   {"key": "BestCompany", "value": true},     
   {"key": "CompanyName", "value": "ONLYOFFICE"} 
]); 
builder.SaveFile("docx", "SetFormsData.docx"); 
builder.CloseFile();
```

## Enhanced WOPI support

The latest release brings the [WOPISrc](https://api.onlyoffice.com/editors/wopi/#wopisrc) query parameter which 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 the Docs API, the [document.key](https://api.onlyoffice.com/editors/config/document#key) parameter is written to `WOPISrc`.

## Conversion API

The [watermark](https://api.onlyoffice.com/editors/conversionapi#watermark) field added to the conversion request defines a JSON object containing the [properties](https://api.onlyoffice.com/plugin/global#watermark_on_draw) of a watermark which is inserted into the PDF and image files during conversion.

```
"async": false,    
"filetype": "docx",     
"key": "Khirz6zTPdfd7",     
"outputtype": "pdf",     
"title": "Example Document Title.docx",     
"url": "https://example.com/url-to-example-document.docx",     
"watermark": {         
  "align": 1,         
  "fill": [255, 0, 0],        
  "height": 100,        
  "margins": [ 10, 10, 10, 10 ],
  ...
```

## Support for Oracle and Microsoft SQL Server databases

Among the supported databases there are now also Oracle and Microsoft SQL Server. To connect it, change the database type to `oracle / mssql`. For Docker, you will need to adjust the [DB_TYPE parameter](https://github.com/ONLYOFFICE/Docker-Docs#available-%D1%81onfiguration-parameters).

## User avatars

Starting from version 8.0, it’s possible to add user avatars to be displayed in the editors for better team visualization.

Thus, the `info` operation type is added to the [setUsers](https://api.onlyoffice.com/editors/methods#setUsers) method and [onRequestUsers](https://api.onlyoffice.com/editors/config/events#onRequestUsers) event to set the avatars for the users with the IDs specified in the `data.id` parameter. And the newly added `users.image` field defines the path to the user avatar.

```
var onRequestUsers = function (event) {     
   var c = event.data.c;     
   var id = event.data.id;    
   ...      
docEditor.setUsers({         
   "c": event.data.c,         
   "users": [             
     {                 
     "email": "john@example.com",                 
     "id": "78e1e841",                 
     "image": "https://example.com/url-to-user-avatar1.png",                 
     "name": "John Smith"             
     },
```
Besides, the [editorConfig.user](https://api.onlyoffice.com/editors/config/editor#user) parameter now contains the _image_ field to define the path to the user avatar:

```
var docEditor = new DocsAPI.DocEditor("placeholder", {    
"editorConfig": {
...
    "user": {             
    "group": "Group1",             
    "id": "78e1e841",             
    "image": "https://example.com/url-to-user-avatar.png",             
    "name": "John Smith"         
     }
```

## API enhancements for plugins

The newly added plugin methods allow launching and managing slideshows:

- [EndSlideShow](https://api.onlyoffice.com/plugin/executemethod/slide/endslideshow)
- [GoToNextSlideInSlideShow](https://api.onlyoffice.com/plugin/executemethod/slide/gotonextslideinslideshow)
- [GoToPreviousSlideInSlideShow](https://api.onlyoffice.com/plugin/executemethod/slide/gotopreviousslideinslideshow)
- [GoToSlideInSlideShow](https://api.onlyoffice.com/plugin/executemethod/slide/gotoslideinslideshow)
- [PauseSlideShow](https://api.onlyoffice.com/plugin/executemethod/slide/pauseslideshow)
- [ResumeSlideShow](https://api.onlyoffice.com/plugin/executemethod/slide/resumeslideshow)
- [StartSlideShow](https://api.onlyoffice.com/plugin/executemethod/slide/startslideshow)

Find below several code samples:

`window.Asc.plugin.executeMethod ("StartSlideShow");`

`window.Asc.plugin.executeMethod ("GoToSlideInSlideShow", [2]);`

`window.Asc.plugin.executeMethod ("EndSlideShow");`

## Further API updates for Document Builder

In the [DocBuilder API](https://api.onlyoffice.com/docbuilder/basic), we also added multiple freeze panes and comment methods, and some others, including the following ones:

- [ApiFreezePanes/GetLocation](https://api.onlyoffice.com/docbuilder/spreadsheetapi/apifreezepanes/getlocation) which returns a range that describes the frozen cells in the active worksheet view.
- [ApiBlockLvlSdt/AddComment](https://api.onlyoffice.com/docbuilder/textdocumentapi/apiblocklvlsdt/addcomment) which adds a comment to the current block content control.
- [ApiSection/GetPageHeight](https://api.onlyoffice.com/docbuilder/textdocumentapi/apisection/getpageheight) which gets page height for current section.
- [ApiDocument/AddDrawingToPage](https://api.onlyoffice.com/docbuilder/textdocumentapi/apidocument/adddrawingtopage) which adds a shape to the specified page.

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

## Useful links

- [What’s new in ONLYOFFICE Docs 8.0](https://www.onlyoffice.com/blog/2024/01/onlyoffice-docs-8-0-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)
- [Download Document Builder](https://www.onlyoffice.com/download-builder.aspx)