On 16-Sep-06 Miklos Somogyi wrote: > Hello! > > Is it possible to insert a graphic as the background > for a page? Sort of similar to the `epsf' special escape > in enscript. > > Even better would be a way to define a PostScript `form' > to be inserted on each page of output. > > This could be useful for letterhead or emulating pre-printed forms. > > Any advice is most appreciated. Thanks! > > Louis
If you want a background on just one page, then the best way is to place it there as the first action before defining any other printing on the page. In the following examples I'm assuming A4 paper, and PS output.. Example 1: A background "Draft" in large grey type, diagonal: a) To use this on just one page, have the following as the first thing in your source file: \X'ps: exec gsave 0.7 setgray \ 196 720 moveto \ -60 rotate 1 -1 scale \ /Helvetica-Bold findfont 180 scalefont setfont \ (D r a f t) show \ grestore' Then continue with the rest of your input. This will be overprinted on the "Draft" background. b) To have this on every page, locate the part of your macro package which prints any page headers. For example, in the ms macros these are the stringa "LH", "CH", "RH". So, in ms macros, start with .ds LH \X'ps: exec gsave 0.7 setgray \ 196 720 moveto \ -60 rotate 1 -1 scale \ /Helvetica-Bold findfont 180 scalefont setfont \ (D r a f t) show \ grestore' \*[LH] The string definition ".ds LH" ensures that the background is printed on every subsequent page, but (at least in ms macros) the headers are not printed on page 1; so that is why there is an explicit "\*[LH]" before you do anything else. Example 2: A background image on a single page Suppose that this image is an EPS file bkg.eps, and its proportions (height by width) are correct for your paper, though perhaps its BoundingBox may be of a different overall size. For A4, height/width = 1.414 ... so let's suppose that the BoundingBox in the EPS file is 20 100 120 241 [ i.e. (241 - 100) = 1.4*(120 - 20) ] so that it's in the same proportions as A4 (not essential of course, depending on your image; just for illustration). Then, using the BoundingBox information, which you have to read from the EPS file, suppose you want this image to be 6in wide (432 points = 432000 groff PS units), and therefore 8.4in tall (604.8 points = 604800 units), with its lefthand side 1in (72 points) from the left and the bottom of the image to be 10in (720p) from the top. This will (roughly) centre the image on the page. Then start your file with \Z'\ \h'1i'\v'10i'\ \X'ps: import bkg.eps 20 100 120 241 43200' \' and continue with the rest of your input for the document. Similarly to (b) for (1) above, if you want this image on every page then you can .ds LH \Z'\ \h'1i'\v'10i'\ \X'ps: import bkg.eps 20 100 120 241 43200' \' \*[LH] However, this will have the effect that for every page in the output, the entire PostScript code of the image will be put into every page in the ouput, which could give a large file for a long document! You can work round this by using "\X'ps: def ... " to define a graphics object in the PostScript once and for all. See my mail to the groff list on 17 October 2005 with subject Re: [Groff] PS and "page background" for a more extended discussion of the issues. Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 16-Sep-06 Time: 20:54:06 ------------------------------ XFMail ------------------------------ _______________________________________________ Groff mailing list Groff@gnu.org http://lists.gnu.org/mailman/listinfo/groff