Exemplo n.º 1
0
/* Send the page to the printer. */
static int
m8510_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
        int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
        byte *in1 = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(in1)");
        byte *in2 = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(in2)");
        byte *out = (byte *) gs_malloc(pdev->memory, 8, line_size, "m8510_print_page(out)");
        int lnum = 0;
        int code = 0;
        byte *inp, *in_end, *outp;
        int i;

        if (in1 == 0 || in2 == 0 || out == 0) {
                code = gs_note_error(gs_error_VMerror);
                goto out;
        }

        /*
         * Initialize the printer.
         * NLQ mode, proportional print (160x144 dpi).
         * and 16/144" linefeeds.
         */
        fwrite("\033m2\033P\033T16", 1, 9, prn_stream);

        /* Transfer pixels to printer */
        while ( lnum < pdev->height ) {
                /* get a raster */
                for (i = 7; i >= 0; i--) {
                        gdev_prn_copy_scan_lines(pdev, lnum, &in1[i*line_size], line_size);
                        lnum++;
                        gdev_prn_copy_scan_lines(pdev, lnum, &in2[i*line_size], line_size);
                        lnum++;
                }

                /* Transpose the 1st pass of data. */
                in_end = in1 + line_size;
                for (inp = in1, outp = out; inp < in_end; inp++, outp += 8)
                        gdev_prn_transpose_8x8(inp, line_size, outp, 1);

                /* send the 1st line */
                m8510_output_run(pdev, out, 0, prn_stream);

                /* Transpose the 2nd pass of data. */
                in_end = in2 + line_size;
                for (inp = in2, outp = out; inp < in_end; inp++, outp += 8)
                        gdev_prn_transpose_8x8(inp, line_size, outp, 1);

                /* send the 2nd line */
                m8510_output_run(pdev, out, 1, prn_stream);
        }

        /* reset the printer. */
        fwrite("\033c1", 1, 3, prn_stream);
        fflush(prn_stream);

out:;
        if (out) gs_free(pdev->memory, (char *) out, 8, line_size, "m8510_print_page(out)");
        if (in2) gs_free(pdev->memory, (char *) in2, 8, line_size, "m8510_print_page(in2)");
        if (in1) gs_free(pdev->memory, (char *) in1, 8, line_size, "m8510_print_page(in1)");

        return code;
}
Exemplo n.º 2
0
/* Send the page to the printer. */
static int
sj48_print_page(gx_device_printer *pdev, FILE *prn_stream)
{	int line_size = gx_device_raster((gx_device *)pdev, 0);
        int xres = pdev->x_pixels_per_inch;
        int yres = pdev->y_pixels_per_inch;
        int mode = (yres == 180 ?
                        (xres == 180 ? 39 : 40) :
                        (xres == 180 ? 71 : 72));
        int bytes_per_column = (yres == 180) ? 3 : 6;
        int bits_per_column = bytes_per_column * 8;
        int skip_unit = bytes_per_column * (xres == 180 ? 1 : 2); /* Skips in step of 1/180" */
        byte *in = (byte *)gs_malloc(pdev->memory, 8, line_size, "sj48_print_page(in)");
        byte *out = (byte *)gs_malloc(pdev->memory, bits_per_column, line_size, "sj48_print_page(out)");
        int lnum = 0;
        int skip = 0;
        int skips;
        int code = 0;
        int last_row = dev_print_scan_lines(pdev);
        int limit = last_row - bits_per_column;

        if ( in == 0 || out == 0 )
        {	code = gs_error_VMerror;
                gs_note_error(code);
                goto fin;
        }

        /* Abort if the requested resolution is unsupported. */
        if ((xres !=180 && xres != 360) || (yres !=180 && yres != 360))
        {	code = gs_error_rangecheck;
                gs_note_error(code);
                goto fin;
        }

        /* Initialize the printer. */
        fwrite("\033@\000\000", 1, 4, prn_stream);  /* <Printer reset>, <0>, <0>. */

        /* Transfer pixels to printer.  The last row we can print is defined
           by "last_row".  Only the bottom of the print head can print at the
           bottom margin, and so we align the final printing pass.  The print
           head is kept from moving below "limit", which is exactly one pass
           above the bottom margin.  Once it reaches this limit, we make our
           final printing pass of a full "bits_per_column" rows. */
        while ( lnum < last_row )
           {
                byte *in_data;
                byte *in_end = in + line_size;
                byte *out_beg = out;
                byte *out_end = out + bytes_per_column * pdev->width;
                byte *outl = out;
                int bnum;

                /* Copy 1 scan line and test for all zero. */
                code = gdev_prn_get_bits(pdev, lnum, in, &in_data);
                if ( code < 0 ) goto xit;
                /* The mem... or str... functions should be faster than */
                /* the following code, but all systems seem to implement */
                /* them so badly that this code is faster. */
                   {	register const long *zip = (const long *)in_data;
                        register int zcnt = line_size;
                        register const byte *zipb;
                        for ( ; zcnt >= 4 * sizeof(long); zip += 4, zcnt -= 4 * sizeof(long) )
                           {	if ( zip[0] | zip[1] | zip[2] | zip[3] )
                                        goto notz;
                           }
                        zipb = (const byte *)zip;
                        while ( --zcnt >= 0 )
                           {
                                if ( *zipb++ )
                                        goto notz;
                           }
                        /* Line is all zero, skip */
                        lnum++;
                        skip++;
                        continue;
notz:			;
                   }

                /* Vertical tab to the appropriate position.  Note here that
                   we make sure we don't move below limit. */
                if ( lnum > limit )
                    {	skip -= (limit - lnum);
                        lnum = limit;
                    }

                /* The SJ48 can only skip in steps of 1/180" */
                if (yres == 180) {
                  skips = skip;
                } else {
                  if (skip & 1) {
                    skip--; /* Makes skip even. */
                    lnum--;
                  }
                  skips = skip/2;
                }

                while ( skips > 255 )
                   {	fputs("\033J\377", prn_stream);
                        skips -= 255;
                   }
                if ( skips )
                        fprintf(prn_stream, "\033J%c", skips);

                /* If we've printed as far as "limit", then reset "limit"
                   to "last_row" for the final printing pass. */
                if ( lnum == limit )
                        limit = last_row;
                skip = 0;

                /* Transpose in blocks of 8 scan lines. */
                for ( bnum = 0; bnum < bits_per_column; bnum += 8 )
                   {	int lcnt = min(8, limit - lnum);
                        byte *inp = in;
                        byte *outp = outl;
                        lcnt = gdev_prn_copy_scan_lines(pdev,
                                lnum, in, lcnt * line_size);
                        if ( lcnt < 0 )
                           {	code = lcnt;
                                goto xit;
                           }
                        if ( lcnt < 8 )
                                memset(in + lcnt * line_size, 0,
                                       (8 - lcnt) * line_size);
                        for ( ; inp < in_end; inp++, outp += bits_per_column )
                           {	gdev_prn_transpose_8x8(inp, line_size,
                                        outp, bytes_per_column);
                           }
                        outl++;
                        lnum += lcnt;
                        skip += lcnt;
                   }

                /* Send the bits to the printer.  We alternate horizontal
                   skips with the data.  The horizontal skips are in units
                   of 1/180 inches, so we look at the data in groups of
                   1 or 2 columns depending on resolution (controlled
                   by skip_unit).  */
                outl = out;
                do
                   {	int count;
                        int n;
                        byte *out_ptr;

                        /* First look for blank groups of columns. */
                        while(outl < out_end)
                           {	n = count = min(out_end - outl, skip_unit);
                                out_ptr = outl;
                                while ( --count >= 0 )
                                   {	if ( *out_ptr++ )
                                                break;
                                   }
                                if ( count >= 0 )
                                        break;
                                else
                                        outl = out_ptr;
                           }
                        if (outl >= out_end)
                                break;
                        if (outl > out_beg)
                           {	count = (outl - out_beg) / skip_unit;
                                fprintf(prn_stream, "\033\\%c%c",
                                        count & 0xff, count >> 8);
                           }

                        /* Next look for non-blank groups of columns. */
                        out_beg = outl;
                        outl += n;
                        while(outl < out_end)
                           {	n = count = min(out_end - outl, skip_unit);
                                out_ptr = outl;
                                while ( --count >= 0 )
                                   {	if ( *out_ptr++ )
                                                break;
                                   }
                                if ( count < 0 )
                                        break;
                                else
                                        outl += n;
                           }
                        count = outl - out_beg;
                        {
                          /* What to transmit is the number of columns in the row.
                             Compare this with the <Esc>|*-command wich expects the
                             total number of bytes in the graphic row! */
                          int count1 = count/bytes_per_column;
                          fprintf(prn_stream, "\033*%c%c%c",
                                  mode, count1 & 0xff, count1 >> 8);
                        }
                        fwrite(out_beg, 1, count, prn_stream);
                        out_beg = outl;
                        outl += n;
                   }
                while ( out_beg < out_end );

                fputc('\r', prn_stream);
                skip = bits_per_column;  /* <CR> only moves to the beginning of the row. */
           }
Exemplo n.º 3
0
/* Send the page to the printer. */
static int
dmp_print_page(gx_device_printer *pdev, FILE *prn_stream)
{
        int dev_type;

        int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
        /* Note that in_size is a multiple of 8. */
        int in_size = line_size * 8;

        byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf1)");
        byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "dmp_print_page(buf2)");
        byte *prn = (byte *)gs_malloc(pdev->memory, 3*in_size, 1, "dmp_print_page(prn)");

        byte *in = buf1;
        byte *out = buf2;
        int lnum = 0;

        /* Check allocations */
        if ( buf1 == 0 || buf2 == 0 || prn == 0 )
        {
                if ( buf1 )
                        gs_free(pdev->memory, (char *)buf1, in_size, 1,
                        "dmp_print_page(buf1)");
                if ( buf2 )
                        gs_free(pdev->memory, (char *)buf2, in_size, 1,
                        "dmp_print_page(buf2)");
                if ( prn )
                        gs_free(pdev->memory, (char *)prn, in_size, 1,
                        "dmp_print_page(prn)");
                return_error(gs_error_VMerror);
        }

        if ( pdev->y_pixels_per_inch == 216 )
                dev_type = IWLQ;
        else if ( pdev->y_pixels_per_inch == 144 )
                dev_type = IWHI;
        else if ( pdev->x_pixels_per_inch == 160 )
                dev_type = IWLO;
        else
                dev_type = DMP;

        /* Initialize the printer and reset the margins. */

        fputs("\r\n\033>\033T16", prn_stream);

        switch(dev_type)
        {
        case IWLQ:
                fputs("\033P\033a3", prn_stream);
                break;
        case IWHI:
        case IWLO:
                fputs("\033P", prn_stream);
                break;
        case DMP:
        default:
                fputs("\033q", prn_stream);
                break;
        }

        /* Print lines of graphics */
        while ( lnum < pdev->height )
        {
                byte *inp;
                byte *in_end;
                byte *out_end;
                int lcnt,ltmp;
                int count, passes;
                byte *prn_blk, *prn_end, *prn_tmp;

/* The apple DMP printer seems to be odd in that the bit order on
 * each line is reverse what might be expected.  Meaning, an
 * underscore would be done as a series of 0x80, while on overscore
 * would be done as a series of 0x01.  So we get each
 * scan line in reverse order.
 */

                switch (dev_type)
                {
                case IWLQ: passes = 3; break;
                case IWHI: passes = 2; break;
                case IWLO:
                case DMP:
                default: passes = 1; break;
                }

                for (count = 0; count < passes; count++)
                {
                        for (lcnt=0; lcnt<8; lcnt++)
                        {
                                switch(dev_type)
                                {
                                case IWLQ: ltmp = lcnt + 8*count; break;
                                case IWHI: ltmp = 2*lcnt + count; break;
                                case IWLO:
                                case DMP:
                                default: ltmp = lcnt; break;
                                }

                                if ((lnum+ltmp)>pdev->height)
                                        memset(in+lcnt*line_size,0,line_size);
                                else
                                        gdev_prn_copy_scan_lines(pdev,
                                        lnum+ltmp, in + line_size*(7 - lcnt),
                                        line_size);
                        }

                        out_end = out;
                        inp = in;
                        in_end = inp + line_size;
                        for ( ; inp < in_end; inp++, out_end += 8 )
                        {
                                gdev_prn_transpose_8x8(inp, line_size,
                                out_end, 1);
                        }

                        out_end = out;

                        switch (dev_type)
                        {
                        case IWLQ: prn_end = prn + count; break;
                        case IWHI: prn_end = prn + in_size*count; break;
                        case IWLO:
                        case DMP:
                        default: prn_end = prn; break;
                        }

                        while ( (int)(out_end-out) < in_size)
                        {
                                *prn_end = *(out_end++);
                                if ((dev_type) == IWLQ) prn_end += 3;
                                else prn_end++;
                        }
                }

                switch (dev_type)
                {
                case IWLQ:
                        prn_blk = prn;
                        prn_end = prn_blk + in_size * 3;
                        while (prn_end > prn && prn_end[-1] == 0 &&
                                prn_end[-2] == 0 && prn_end[-3] == 0)
                        {
                                prn_end -= 3;
                        }
                        while (prn_blk < prn_end && prn_blk[0] == 0 &&
                                prn_blk[1] == 0 && prn_blk[2] == 0)
                        {
                                prn_blk += 3;
                        }
                        if (prn_end != prn_blk)
                        {
                                if ((prn_blk - prn) > 7)
                                        fprintf(prn_stream,"\033U%04d%c%c%c",
                                                (int)((prn_blk - prn)/3),
                                                0, 0, 0);
                                else
                                        prn_blk = prn;
                                fprintf(prn_stream,"\033C%04d",
                                        (int)((prn_end - prn_blk)/3));
                                fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
                                        prn_stream);
                        }
                        break;
                case IWHI:
                        for (count = 0; count < 2; count++)
                        {
                                prn_blk = prn_tmp = prn + in_size*count;
                                prn_end = prn_blk + in_size;
                                while (prn_end > prn_blk && prn_end[-1] == 0)
                                        prn_end--;
                                while (prn_blk < prn_end && prn_blk[0] == 0)
                                        prn_blk++;
                                if (prn_end != prn_blk)
                                {
                                        if ((prn_blk - prn_tmp) > 7)
                                                fprintf(prn_stream,
                                                        "\033V%04d%c",
                                                        (int)(prn_blk-prn_tmp),
                                                         0);
                                        else
                                                prn_blk = prn_tmp;
                                        fprintf(prn_stream,"\033G%04d",
                                                (int)(prn_end - prn_blk));
                                        fwrite(prn_blk, 1,
                                                (int)(prn_end - prn_blk),
                                                prn_stream);
                                }
                                if (!count) fputs("\033T01\r\n",prn_stream);
                        }
                        fputs("\033T15",prn_stream);
                        break;
                case IWLO:
                case DMP:
                default:
                        prn_blk = prn;
                        prn_end = prn_blk + in_size;
                        while (prn_end > prn_blk && prn_end[-1] == 0)
                                prn_end--;
                        while (prn_blk < prn_end && prn_blk[0] == 0)
                                prn_blk++;
                        if (prn_end != prn_blk)
                        {
                                if ((prn_blk - prn) > 7)
                                        fprintf(prn_stream,"\033V%04d%c",
                                                (int)(prn_blk - prn), 0);
                                else
                                        prn_blk = prn;
                                fprintf(prn_stream,"\033G%04d",
                                        (int)(prn_end - prn_blk));
                                fwrite(prn_blk, 1, (int)(prn_end - prn_blk),
                                        prn_stream);
                        }
                        break;
                }

                fputs("\r\n",prn_stream);

                switch (dev_type)
                {
                        case IWLQ: lnum += 24 ; break;
                        case IWHI: lnum += 16 ; break;
                        case IWLO:
                        case DMP:
                        default: lnum += 8 ; break;
                }
        }

        /* ImageWriter will skip a whole page if too close to end */
        /* so skip back more than an inch */
        if ( !(dev_type == DMP) )
                fputs("\033T99\n\n\033r\n\n\n\n\033f", prn_stream);

        /* Formfeed and Reset printer */
        fputs("\033T16\f\033<\033B\033E", prn_stream);
        fflush(prn_stream);

        gs_free(pdev->memory, (char *)prn, in_size, 1, "dmp_print_page(prn)");
        gs_free(pdev->memory, (char *)buf2, in_size, 1, "dmp_print_page(buf2)");
        gs_free(pdev->memory, (char *)buf1, in_size, 1, "dmp_print_page(buf1)");
        return 0;
}
Exemplo n.º 4
0
/* Send the page to the printer. */
#define DD 0x40				/* double density flag */
static int
eps_print_page(gx_device_printer *pdev, FILE *prn_stream, int y_9pin_high,
  const char *init_string, int init_length, const char *end_string,
  int archaic, int tab_hiccup)
{	
	static const char graphics_modes_9[5] =
	{	
	-1, 0 /*60*/, 1	/*120*/, 7 /*180*/, DD+3 /*240*/
	};

	static const char graphics_modes_24[7] =
	{	
    	-1, 32 /*60*/, 33 /*120*/, 39 /*180*/,
	DD+35 /*240*/, -1, DD+40 /*360*/
	};

	int y_24pin = (y_9pin_high ? 0 : pdev->y_pixels_per_inch > 72);
	int in_y_mult = ((y_24pin | y_9pin_high) ? 3 : 1);
	int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
	/* Note that in_size is a multiple of 8. */
	int in_size = line_size * (8 * in_y_mult);
	byte *buf1 = (byte *)gs_malloc(pdev->memory, in_size, 1, "eps_print_page(buf1)");
	byte *buf2 = (byte *)gs_malloc(pdev->memory, in_size, 1, "eps_print_page(buf2)");
	byte *in = buf1;
	byte *out = buf2;
	int out_y_mult = (y_24pin ? 3 : 1);
	int x_dpi = (int)pdev->x_pixels_per_inch;
	char start_graphics =
		(y_24pin ? graphics_modes_24 : graphics_modes_9)[x_dpi / 60];
	int first_pass = (start_graphics & DD ? 1 : 0);
	int last_pass = first_pass * (y_9pin_high == 2 ? 1 : 2); 
	int y_passes = (y_9pin_high ? 3 : 1);
	int dots_per_space = x_dpi / 10;	/* pica space = 1/10" */
	int bytes_per_space = dots_per_space * out_y_mult;
	int tab_min_pixels = x_dpi * MIN_TAB_10THS / 10;
	int skip = 0, lnum = 0, pass, ypass;

	/* Check allocations */
	if ( buf1 == 0 || buf2 == 0 )
	{	if ( buf1 ) 
		  gs_free(pdev->memory, (char *)buf1, in_size, 1, "eps_print_page(buf1)");
		if ( buf2 ) 
		  gs_free(pdev->memory, (char *)buf2, in_size, 1, "eps_print_page(buf2)");
		return_error(gs_error_VMerror);
	}

	/* Initialize the printer and reset the margins. */
	fwrite(init_string, 1, init_length, prn_stream);
	if ( init_string[init_length - 1] == 'Q' )
		fputc((int)(pdev->width / pdev->x_pixels_per_inch * 10) + 2,
		      prn_stream);

	/* Calculate the minimum tab distance. */
	if ( tab_min_pixels < max(MIN_TAB_PIXELS, 3) )
		tab_min_pixels = max(MIN_TAB_PIXELS, 3);
	tab_min_pixels -= tab_min_pixels % 3;	/* simplify life */

	/* Print lines of graphics */
	while ( lnum < pdev->height )
	{	
		byte *in_data;
		byte *inp;
		byte *in_end;
		byte *out_end;
		byte *out_blk;
		register byte *outp;
		int lcnt;

		/* Copy 1 scan line and test for all zero. */
		gdev_prn_get_bits(pdev, lnum, in, &in_data);
		if ( in_data[0] == 0 &&
		     !memcmp((char *)in_data, (char *)in_data + 1, line_size - 1)
		   )
	    	{	
			lnum++;
			skip += 3 / in_y_mult;
			continue;
		}

		/* Vertical tab to the appropriate position. */
		while ( skip > 255 )
		{	
			fputs("\033J\377", prn_stream);
			skip -= 255;
		}
		if ( skip )
		{
			fprintf(prn_stream, "\033J%c", skip);
		}

		/* Copy the the scan lines. */
	    	lcnt = gdev_prn_copy_scan_lines(pdev, lnum, in, in_size);
		if ( lcnt < 8 * in_y_mult )
		{	/* Pad with lines of zeros. */
			memset(in + lcnt * line_size, 0,
			       in_size - lcnt * line_size);
		}

		if ( y_9pin_high == 2 ) 
		{	/* Force printing of every dot in one pass */
			/* by reducing vertical resolution */
		        /* (ORing with the next line of data). */
		        /* This is necessary because some Epson compatibles */
			/* can't print neighboring dots. */
			int i;
			for ( i = 0; i < line_size * in_y_mult; ++i )
				in_data[i] |= in_data[i + line_size];
		}

		if ( y_9pin_high )
		{	/* Shuffle the scan lines */
			byte *p;
			int i;
			static const char index[] =
			{  0,  8, 16,  1,  9, 17,  
			   2, 10, 18,  3, 11, 19,
			   4, 12, 20,  5, 13, 21,
			   6, 14, 22,  7, 15, 23
			};

			for ( i = 0; i < 24; i++ )
			{
				memcpy(out+(index[i]*line_size),
				       in+(i*line_size), line_size);
			}
			p = in;
			in = out;
			out = p;
		}

	for ( ypass = 0; ypass < y_passes; ypass++ )
	{
	    for ( pass = first_pass; pass <= last_pass; pass++ )
	    {
		/* We have to 'transpose' blocks of 8 pixels x 8 lines, */
		/* because that's how the printer wants the data. */
		/* If we are in a 24-pin mode, we have to transpose */
		/* groups of 3 lines at a time. */

		if ( pass == first_pass )
		{
		    out_end = out;
		    inp = in;
		    in_end = inp + line_size;
    
		    if ( y_24pin )
    	            { 
    			for ( ; inp < in_end; inp++, out_end += 24 )
    			{ 
    	    	            gdev_prn_transpose_8x8(inp, line_size, out_end, 3);
    	                    gdev_prn_transpose_8x8(inp + line_size * 8, 
					           line_size, out_end + 1, 3);
    	                    gdev_prn_transpose_8x8(inp + line_size * 16, 
					           line_size, out_end + 2, 3);
			}
			/* Remove trailing 0s. */
			while ( out_end > out && out_end[-1] == 0 &&
    	   			out_end[-2] == 0 && out_end[-3] == 0)
			{
		             out_end -= 3;
			}
    	            }
		    else
    	            { 
    			for ( ; inp < in_end; inp++, out_end += 8 )
    			{ 
    		            gdev_prn_transpose_8x8(inp + (ypass * 8*line_size), 
					           line_size, out_end, 1);
		    	}
			/* Remove trailing 0s. */
			while ( out_end > out && out_end[-1] == 0 )
	        	{
		       	    out_end--;
			}
    	    	    }
		}

		for ( out_blk = outp = out; outp < out_end; )
    		{ 
    	 	    /* Skip a run of leading 0s.  At least */
    	            /* tab_min_pixels are needed to make tabbing */
    		    /* worth it.  We do everything by 3's to */
    		    /* avoid having to make different cases */
    		    /* for 9- and 24-pin. */
		   if ( !archaic &&
			*outp == 0 && out_end - outp >= tab_min_pixels &&
			(outp[1] | outp[2]) == 0 &&
			!memcmp((char *)outp, (char *)outp + 3,
				tab_min_pixels - 3)
		      )
    	    	    {
    			byte *zp = outp;
			int tpos;
			byte *newp;
           
			outp += tab_min_pixels;
    			while ( outp + 3 <= out_end && 
    		     		*outp == 0 &&
    				outp[1] == 0 && outp[2] == 0 )
    			{
			    outp += 3;
    			}
			tpos = (outp - out) / bytes_per_space;
			newp = out + tpos * bytes_per_space;
			if ( newp > zp + 10 )
    			{ 
    			    /* Output preceding bit data.*/
    		   	    if ( zp > out_blk )	
    			    {
    				/* only false at beginning of line */
			     	eps_output_run(out_blk, (int)(zp - out_blk),
    				    	       out_y_mult, start_graphics, 
					       prn_stream,
					       (y_9pin_high == 2 ?
					        (1 + ypass) & 1 : pass));
			    }
			    /* Tab over to the appropriate position. */
			    if ( tab_hiccup )
			      fputs("\010 ", prn_stream); /* bksp, space */
			    /* The following statement is broken up */
			    /* to work around a bug in emx/gcc. */
			    fprintf(prn_stream, "\033D%c", tpos);
			    fputc(0, prn_stream);
			    fputc('\t', prn_stream);
			    out_blk = outp = newp;
			}
		    }
		    else
		    {
    			outp += out_y_mult;
		    }
    		}
		if ( outp > out_blk )
		{
		    eps_output_run(out_blk, (int)(outp - out_blk),
			           out_y_mult, start_graphics,
				   prn_stream,
				   (y_9pin_high == 2 ? (1 + ypass) & 1 : pass));
		}

		fputc('\r', prn_stream);
	    }
	    if ( ypass < y_passes - 1 )
		fputs("\033J\001", prn_stream);
	}
	skip = 24 - y_passes + 1;		/* no skip on last Y pass */
	lnum += 8 * in_y_mult;
	}

	/* Eject the page and reinitialize the printer */
	fputs(end_string, prn_stream);
	fflush(prn_stream);

	gs_free(pdev->memory, (char *)buf2, in_size, 1, "eps_print_page(buf2)");
	gs_free(pdev->memory, (char *)buf1, in_size, 1, "eps_print_page(buf1)");
	return 0;
}