---
title: "file.compare: Compare files — PDF kit command — Kition"
description: "Compare the text of two open documents: other is the older version, doc the newer. Returns counts and each change (replaced, inserted, deleted) with the old and new text, pages (1-based) and rectangles (points, origin bottom-left)."
canonical: "https://developer.kition.ai/docs/kits/pdf/commands/file.compare"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/pdf/commands/file.compare](https://developer.kition.ai/docs/kits/pdf/commands/file.compare)

# file.compare

**Compare files.** Compare the text of two open documents: other is the older version, doc the newer. Returns counts and each change (replaced, inserted, deleted) with the old and new text, pages (1-based) and rectangles (points, origin bottom-left).

- Kit: PDF 0.1.0 (.pdf); reference: [PDF kit commands](https://developer.kition.ai/docs/kits/pdf.md)
- Changes the document: no

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `limit` | `integer` | no | List at most this many changes (default 500). (minimum 1) |
| `other` | `integer` | yes | The older document (from doc_open). |
| `visual` | `boolean` | no | Also compare how pages look (page n with page n): regions that differ visually. |

## Call through pdf_run

```text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "file.compare", "params": { "other": <integer> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `limit`, `visual`. pdf_run answers the step’s result in `completed[i].result`.

## Result



```json
{
  "additionalProperties": true,
  "description": "the differences between the two documents, page by page",
  "type": "object"
}
```

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "limit": {
      "description": "List at most this many changes (default 500). (minimum 1)",
      "type": "integer"
    },
    "other": {
      "description": "The older document (from doc_open).",
      "type": "integer"
    },
    "visual": {
      "description": "Also compare how pages look (page n with page n): regions that differ visually.",
      "type": "boolean"
    }
  },
  "required": [
    "other"
  ],
  "type": "object"
}
```

Generated from the command list of @kition/pdf-darwin-arm64@0.1.0 and the kit itself (pdf_commands through @kition/cli@0.1.1, built from KitionAI/kition-pdf@b0d2725).
