CaseLeaf

Handbook / The `similar` command

The similar command

A bundle assembled from four sources runs to six hundred pages, and you suspect the same appendix is in it three times.

Reports which sheets are near-duplicates of one another. It is for the document that has accumulated: the same appendix bound in three times, a scan that double-fed, a bundle assembled from overlapping sources. Use it before paginating or sending a long document, and before anybody is asked to read all of it.

How you run it

caseleaf similar report.pdf

caseleaf similar report.pdf --within 12

What each part means

In full, every part it will take:

caseleaf similar <file> [--within <bits>]
part what it is for
<file> The PDF to work on, as a path, such as report.pdf beside you, or the full path to it. It is read and not written.
--within How different two pages may be and still count as one picture, in bits of a 64-bit fingerprint. 0 is identical; 5 by default. (optional)

It reports and removes nothing. Two slides that differ by one number look alike to any such measure, which is why the answer is a list to look at rather than a change to the document.

What comes back

Asked of a short sample document, it answers as below. The sample has eight sheets, a highlight and a note left by a reviewer, a web link, a small table, two pictures and one form field already filled in.

{
  "distances" : [
    {
      "after" : 1,
      "bits" : 7
    },
    {
      "after" : 2,
      "bits" : 6
    },
    {
      "after" : 3,
      "bits" : 0
    },
  … and the rest of the answer

The same thing from AppleScript

Everything above can be asked for from a script instead. There is one AppleScript command, perform: on names the document, and options takes the rest exactly as you would type it.

tell application "CaseLeaf"
    perform "similar" on "/path/to/report.pdf"
end tell

tell application "CaseLeaf"
    perform "similar" on "/path/to/report.pdf" ¬
        options "--within 12"
end tell

All the commands · Asking from a script · Contents