Search code examples
layoutstandardsrtfpage-layout

Laying out graphics in RTF


I'm interested how to construct certain kinds of layout in RTF documents, ideally using techniques that do not depend only on the most recent RTF standards, and that are "native", i.e., they do not involve embedding other representations, like picture files. In particular:

  1. In Postscript and DVI, I can specify a coordinate at any time that the next text will be printed at: can this be done with RTF?
  2. Can RTF compose characters through overstriking?
  3. Can lines, outline boxes and filled boxes be drawn, with their geometry specified either absolutely, or relative to text?

Solution

    1. You can use the \pvpg \phpg \posx123 \posy123 construct after you start a paragraph with \pard to position it relative to the top left of the page. See: http://biblioscape.com/rtf15_spec.htm#Heading39

    2. Yes, but it's rather involved, and I think it was only introduced in RTF 1.5. See the drawing objects section of the spec. Here is a basic example of drawing a box (I'm not sure it's entirely valid but it should give you an idea of how to work with drawing objects):

      {\rtf1\ansi\deff0 {\pard {\*\do \dobxcolumn \dobypara \dprect \dpx0 \dpy0 \dpxsize1000 \dpysize1000 \dplinew25 }\par} }

    If you're doing any work with RTF it's worth picking up O'Reilly's RTF Pocket Guide.