CaseLeaf

Handbook / The `docx` command

The docx command

A reviewer will only work in Word, and the document you have to send them is a PDF.

Writes a Word document that looks like this one. It is for the last step of a process, when somebody who does not have the document's own application needs to work on the words: a reviewer who redlines in Word, a colleague who will not open a PDF. What comes out is a rendering, not a source: round-tripping it back will not return the document you started with.

How you run it

caseleaf docx report.pdf --to file.docx

What each part means

In full, every part it will take:

caseleaf docx <file> --to <file.docx>
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.
--to Where to write the Word document, as a path ending .docx, such as report.docx. The PDF you named is not changed, and what comes out is a rendering: opening it in Word and saving will not give you the original back.

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.

{
  "blocks" : 1,
  "externalLinks" : 1,
  "figuresEmbedded" : 2,
  "figuresFound" : 2,
  "formulaeEmbedded" : 0,
  "formulaeFound" : 0,
  "internalLinks" : 0,
  "pages" : 8,
  "rules" : 9,
  "wrote" : "file.docx"
}

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 "docx" on "/path/to/report.pdf" ¬
        options "--to file.docx"
end tell

All the commands · Asking from a script · Contents