1
/* Copyright (C) 2001-2012 Artifex Software, Inc.
4
This software is provided AS-IS with no warranty, either express or
7
This software is distributed under license and may not be copied,
8
modified or distributed except as expressly authorized under the terms
9
of the license contained in the file LICENSE in this distribution.
11
Refer to licensing information at http://www.artifex.com or contact
12
Artifex Software, Inc., 7 Mt. Lassen Drive - Suite A-134, San Rafael,
13
CA 94903, U.S.A., +1(415)492-9861, for further information.
16
/* Ricoh 4081 laser printer driver */
19
#define X_DPI 300 /* pixels per inch */
20
#define Y_DPI 300 /* pixels per inch */
22
/* The device descriptor */
23
static dev_proc_print_page(r4081_print_page);
24
const gx_device_printer far_data gs_r4081_device =
25
prn_device(prn_bg_procs, "r4081", /* The print_page proc is compatible with allowing bg printing */
26
85, /* width_10ths, 8.5" */
27
110, /* height_10ths, 11" */
29
0.25, 0.16, 0.25, 0.16, /* margins */
32
/* ------ Internal routines ------ */
34
/* Send the page to the printer. */
36
r4081_print_page(gx_device_printer *pdev, FILE *prn_stream)
38
int line_size = gdev_mem_bytes_per_scan_line((gx_device *)pdev);
39
int out_size = ((pdev->width + 7) & -8) ;
40
byte *out = (byte *)gs_malloc(pdev->memory, out_size, 1, "r4081_print_page(out)");
42
int last = pdev->height;
44
/* Check allocations */
47
gs_free(pdev->memory, (char *)out, out_size, 1,
48
"r4081_print_page(out)");
52
/* find the first line which has something to print */
55
gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
57
memcmp((char *)out, (char *)out+1, line_size-1)
63
/* find the last line which has something to print */
65
gdev_prn_copy_scan_lines(pdev, last-1, (byte *)out, line_size);
67
memcmp((char *)out, (char *)out+1, line_size-1)
73
/* Initialize the printer and set the starting position. */
74
fprintf(prn_stream,"\033\rP\033\022YB2 \033\022G3,%d,%d,1,1,1,%d@",
75
out_size, last-lnum, (lnum+1)*720/Y_DPI);
77
/* Print lines of graphics */
80
gdev_prn_copy_scan_lines(pdev, lnum, (byte *)out, line_size);
81
fwrite(out, sizeof(char), line_size, prn_stream);
85
/* Eject the page and reinitialize the printer */
86
fputs("\f\033\rP", prn_stream);
88
gs_free(pdev->memory, (char *)out, out_size, 1, "r4081_print_page(out)");