Setting Left and Right margins (or indent)

I would like to be able to set the left and right margin for a block of selected text in a rich text document.

I used one of the DEVON provided scripts to learn how to refer to the selected text of the think window. However, there don’t seem to be left and right margin properties. I am using the head indent and first line head indent to deal with the left margin – is that the only way? Can these properties be specified in inches, to match the ruler units?

How can I indent the right margin?

I am setting the background of the text block to light grey, but the color extends out to the leftmost margin of the window for all lines that are not the first line of a paragraph. The ragged left edge doesn’t look so hot. Any other way?

Does rich text format allow for borders, eg. a box around the text block? Would be nice to have that as a scriptable property.



Those properties are specified in points (1/72 inch).

That’s not possible, the only workaround would be to use a bordered table having one row and one column.

I wrote an AppleScript that exports the RTF file (to the /tmp directory), reads its current margins, allows you to enter new margins, saves those margins into the RTF source code, then opens it with TextEdit for printing. You can download the script from

I’d design the script to save those changes BACK into DEVONthink, but there is no way to access the source of an RTF file in DEVONthink. That’s too bad, since they made it possible to access HTML source. Would it be possible to allow scripters access to both read and write the RTF source code directly? It would make my life a lot easier.


Thanks for the nice script. It works well with RTF documents, but I can’t seem to make it work with plain text format. Do you know if there’s a way to do the same purpose with plain text? (yeah I know there’s no good way to save the margin info with the text, but that’s ok with me…)



No, that’s not possible.

Plain text is just that - there is no formatting built-in to the saved file. However, there may be a way that you can get a plain text file to print with custom margins. It involves making a modified copy of TextEdit using Apple’s Developer Tools that adds a Set Page Margin menu item. You can then set the page margins using that menu and then print. The changed margins will not save with the file, but it can be done. The changes are described at:

Note: If you want to print a plain text file with small margins (about 0.3 inch), you can just use TextWrangler. There are probably many other options for printing plain text with small margins (mimic your plain text in RTF by using a monospace font, etc.).