Skip to main content

Document Compare API Front SDK Integration

After completing Front SDK integration, Filez Document Platform supports calling the document compare API via Front SDK integration.

Description: Document compare API is used to compare the differences between two text documents with similar content. Users need to provide two text documents with similar content, such as document A and document B. The comparison result is provided as an HTML page that displays the original document, the comparison document, and their differences.

Usage: The business system frontend calls ZOfficeSDK.mount(initConfig, container) to display the comparison result page in the mount container. meta.id and metaB.id are the IDs of document A and document B in the business system respectively (meta.id is the original document in the display page, metaB.id is the comparison document in the display page).

Notes:

  1. Document compare API can only be called after users complete Front SDK integration for online editing.
  2. For parameter details, refer to Front SDK Configuration and Token Signing.

On top of the regular Front SDK initConfig, document comparison requires additionally providing metaB and repoConfig.downloadUrlB, and setting openConfig.action to compare. metaB has the same structure as meta. See Configuration - meta.

Parameter NameRequiredDescription
userinfoYesUser information for the operation. See Configuration - userinfo
metaYesMetadata for document A. meta.id is the original document ID
metaBYesMetadata for document B, same structure as meta. metaB.id is the comparison document ID
openConfig.actionYesIdentifies the action to open the document, value is compare
repoConfig.downloadUrlYesAddress to download docA file stream.
The host of downloadUrl must match the interface address prefix configured for this application in the management console. host includes hostname and port. If the host in downloadUrl does not include a port, the related configuration should not include a port either, even for default ports
repoConfig.downloadUrlBYesAddress to download docB file stream. Same rules as repoConfig.downloadUrl
repoConfig.paramsNoBusiness parameters passed back when calling third-party interfaces. See Configuration - repoConfig.params
tokenYesJWT signed by the business system backend using the integration secret. The signing payload must include userinfo, meta, metaB, openConfig, and repoConfig (including downloadUrl and downloadUrlB)

Integration Example

<!DOCTYPE html>
<html style="height: 100%;">
<head>
<meta charset="UTF-8" />
<title>FrontSDK Document Compare</title>
<script src="sdk.js"></script>
<style>
html, body { height: 100%; margin: 0; padding: 0; overflow: hidden; }
</style>
</head>
<body>
<div id="frameholder" style="height: 100%;"></div>
<script>
// TODO: Generated and returned by your business system backend
const initConfig = {
userinfo: { id: "user", display_name: "user", email: "user@example.com" },
meta: {
id: "docAId",
name: "contract-v1.docx",
modified_at: "2025-11-18T10:41:52.12Z",
created_by: { id: "user", name: "user", email: "user@example.com" },
permissions: { read: true, write: false }
},
metaB: {
id: "docBId",
name: "contract-v2.docx",
modified_at: "2025-11-20T08:15:30.00Z",
created_by: { id: "user", name: "user", email: "user@example.com" },
permissions: { read: true, write: false }
},
repoConfig: {
id: "repoId",
downloadUrl: "http://my.integration.com/v2/context/docAId/content",
downloadUrlB: "http://my.integration.com/v2/context/docBId/content",
params: { "x-param-1": "aaa" }
},
openConfig: { action: "compare" },
documentServerAddr: "http://zoffice_hostname:8001/docs",
token: "YOUR_SIGNED_JWT_TOKEN"
};

ZOfficeSDK.mount(initConfig, "#frameholder");
</script>
</body>
</html>
Size Limit

Currently only supports doc / docx documents, size not exceeding 50M. Only supports comparing two existing remote files in the third-party repository. downloadUrl and downloadUrlB must not be the same.