[comp.lang.postscript] Help including PostScript images in troff

davy@riacs.edu (Dave Curry) (02/22/89)

Hi,

  I'm trying to include the output of a program called "sun2ps"
(converts Sun raster files to PostScript) in my troff source, and not
having much luck.

  I have tried using the "psfig" program (along with the modified
psdit and psdit.pro), using "!PB" directly with psdit, and using the
macro recently posted by euteal!mart.  I send the output to the
LaserWriter, the light blinks for a while, and then I get nothing, not
even a blank piece of paper.  Other pages in the document without
figures on them come out fine.

  The PostScript I'm trying to include looks like:

%!
/inch {72 mul} def
/bpp 1 def
/scanlines 900 def
/scansize 1152 def
/bitmapx
{ 1152 900 1 [1152 0 0 -900 0 900] {currentfile readrlehexstring pop } image
} def
gsave
0.500000 inch 0.500000 inch translate
0.000000 rotate
7.500000 inch 5.859375 inch scale
/readrlehexstring	% rle_file => decoded_string boolean
{
	/fileptr exch def
	fileptr 1 string readhexstring {
		0 get dup 128 and 0 eq
		{ 1 add /Buffer exch string def
			fileptr Buffer readhexstring
		}
		{ 256 exch sub /BufCount exch def
			/Buffer BufCount 1 add string def
			/RunInt fileptr 1 string readhexstring pop 0 get def
			0 1 BufCount { RunInt Buffer 3 1 roll put } for
			Buffer true
		} ifelse
	}
	{ false } ifelse
} def
/clipathx
{	newpath
	0 0 moveto
	7.500000 inch 0 lineto
	7.500000 inch 5.859375 inch lineto
	0 5.859375 inch lineto
	closepath
} def
clipathx clip
bitmapx
c2550051c2110015f155c2aa0084c244
006af1aac2550062f322da00ff22f9aa
00adf155c2aaf288da0001888df95500
52f1aa005fc4ff01fd51f41101107ff9

	[... ~ 2700 lines deleted ...]

4ae6aa00a9bf44d0aa00b5e6550054c0
220023d055004ae5aa8e880095e65500
508111f1118144f1448122f1228188f4
8802888888
grestore
showpage

  I know only a little about PostScript.  I do recall the psdit manual
page mentioning something about only being able to include "well
behaved" PostScript, but they didn't bother to define just what "well
behaved" means.  Is the above doing something which would screw other
things up?

I'm so confused,

Dave Curry
davy@riacs.edu

jos@idca.tds.PHILIPS.nl (Jos Vos) (02/22/89)

In article <1269@hydra.riacs.edu> davy@hydra.riacs.edu.UUCP (Dave Curry) writes:

>  I'm trying to include the output of a program called "sun2ps"
>(converts Sun raster files to PostScript) in my troff source, and not
>having much luck.

The PostScript source should include a line of the format

	%%BoundingBox: a b c d

where a, b, c and d are numbers. Furthermore, some special commands
should not be present in the source.
All this information *can* be found in the psfig documentation!

-- 
-- ######   Jos Vos   ######   Internet   jos@idca.tds.philips.nl   ######
-- ######             ######   UUCP         ...!mcvax!philapd!jos   ######