Skip to main content
Version: SDK-3.10

Start the connection


⚠️ Make sure you have read 接入须知it.

⚠️ Make sure to call as specified , 地址``方法, ,HTTP Header ,

Application appId``secret

Contact Graphite to obtain the and for docking with Graphite SDK appId secret, and you can perform the following operations after obtaining it:

The accessing party needs to keep the obtained appId and secret .

Collaborative documentation

Before you start accessing the collaboration document, you need to understand or prepare the following items:

  • The signature (see Signature Implementation Details) parameter that needs to be provided for access
  • The web page developed by the accessing party is used to host the graphite editor
  • Develop a number of callback interfaces

⚠️ To achieve the most basic document collaboration, the access party needs to develop at least the following two interfaces:

If you want to use the full functionality, implement all of the 接入方实现接口 features or implement 常见功能场景相关接口清单 the features required by the department.

Access process

  1. Call the Create API to create a graphite document
  2. In the web page developed by the accessing party, the graphite JSSDK is introduced
  3. Follow the prompts to initialize the editor according to the README in the JSSDK npm package

File preview

The online preview function refers to the docx``xlsx pptx conversion of Office files such as , etc., into a form that can be previewed and viewed in the browser.


⚠️ This feature does not support editing documents, if you want to edit documents, please refer to 协同文档.

Support format

file typeSupported extension formats
Word file.doc .docx .wps .wpt
Excel file.xls .xlsx .xlsm .csv
PPT file.ppt .pptx
PDF file.pdf .rtf
TXT file.txt
Audio files.mp3 .mp4
Picture file.jpg .jpeg .png .gif .bmp .svg .heic .heif
Other documents.ofd .rtf .md

Before you start previewing the access file, you need to know or prepare the following items:

Access instructions

  1. To create a preview task by using Create Preview, you need to specify the file download address in the downloadUrl field of the API to get file meta information, for examplehttp(s)://{domain}/static/files/2017.docx, the graphite server will download the file from this address and process it. Make sure that the address can be accessed by the graphite server.

  2. Preview the file by visiting the preview page.

HTTP Response Header requirements

⚠️ Note:

In order to ensure that the file type can be correctly recognized, the HTTP response header when the download address is accessed must ensure one of the following conditions (if the return is incorrect, the preview will fail due to the incorrect identification of the file type).


The HTTP ResponseHeader needs to return the correct Content-Disposition information (see MDN Content-Disposition), as follows:

Content-Disposition: attachment; filename="yourfilename.docx"


The HTTP ResponseHeader needs to return the correct Content-Type information, as follows


Several types of Content-Type examples

ExtensionThe corresponding Content-Type value

File extension field

The extension information of the file is returned in the Field of Get File Meta Information API - File Previewext.


The preview file download address (downloadUrl) is , https://your-domain/static/files/1234 and the accessing party cannot return any of the following header information when requesting the download, which is used by the Graphite SDK to identify the file type:

  • Content-Type
  • Content-Disposition

This can be done via the field returned in the meta information ext .

If you ext: "docx" tell the Graphite SDK that the extension of this file is recognized as a Word file, see the following callback interface example highlighted line.

通过回调接口中的 ext 字段指定文件类型
"id": "ba13551165cc5066",
"name": "示例文档.docx",
"type": "file",
"permissions": {
"readable": true
"downloadUrl": "",
"ext": "docx" // 用于标识文件类型