Document

Description

The document section allows to change all the parameters pertaining to the document (title, url, file type, etc.).

Parameters

NameDescriptionTypeExample
fileTypeDefines the type of the file for the source viewed or edited document. Must be lowercase. The following file types are available: .csv, .djvu, .doc, .docm, .docx, .docxf, .dot, .dotm, .dotx, .epub, .fb2, .fodp, .fods, .fodt, .htm, .html, .mht, .odp, .ods, .odt, .oform, .otp, .ots, .ott, .oxps, .pdf, .pot, .potm, .potx, .pps, .ppsm, .ppsx, .ppt, .pptm, .pptx, .rtf, .txt, .xls, .xlsb, .xlsm, .xlsx, .xlt, .xltm, .xltx, .xml, .xps.string“docx”
keyDefines the unique document identifier used by the service to recognize the document. In case the known key is sent the document will be taken from the cache. Every time the document is edited and saved, the key must be generated anew. The document url can be used as the key but without the special characters and the length is limited to 128 symbols.string“Khirz6zTPdfd7”
The key characters can be used: 0-9, a-z, A-Z, -._=. The maximal key length is 20 characters.
referenceDataDefines an object that is generated by the integrator to uniquely identify a file in its system:
  • fileKey - the unique document identifier used by the service to get a link to the file. It must not be changed when the document is edited and saved (i.e. it is not equal to the document.key parameter),
    type: string,
    example: “BCFA2CED”;
  • instanceId - the unique system identifier. If the data was copied from a file on one system, and inserted into a file on another, then pasting by link will not be available and there will be no corresponding button in the context menu,
    type: string,
    example: “https://example.com“.
object
titleDefines the desired file name for the viewed or edited document which will also be used as file name when the document is downloaded. The length is limited to 128 symbols.string“Example Document Title.docx”
urlDefines the absolute URL where the source viewed or edited document is stored. Be sure to add a token when using local links. Otherwise, an error will occur.stringhttps://example.com/url-to-example-document.docx

* - required field

Example

  1. var docEditor = new DocsAPI.DocEditor("placeholder", {
  2. "document": {
  3. "fileType": "docx",
  4. "key": "Khirz6zTPdfd7",
  5. "referenceData": {
  6. "fileKey": "BCFA2CED",
  7. "instanceId": "https://example.com"
  8. },
  9. "title": "Example Document Title.docx",
  10. "url": "https://example.com/url-to-example-document.docx",
  11. },
  12. ...
  13. });

Where the example.com is the name of the server where document manager and document storage service are installed. See the How it works section to find out more on Document Server service client-server interactions.