new port: print/epsonepl "Printer filter for EPSON EPL-5700L etc"

This is a printer filter for the EPSON EPL-5700L, EPL-5800L
	and EPL-5900L budget models of EPSON's laser printers.

	This port also provides a driver for apsfilter.

PR:		ports/48292
Submitted by:	Simon 'corecode' Schubert <corecode@corecode.ath.cx>
This commit is contained in:
Edwin Groothuis 2003-10-10 04:26:14 +00:00
parent 309b4a8bd4
commit b36fde2929
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=90734
11 changed files with 443 additions and 0 deletions

View File

@ -54,6 +54,7 @@
SUBDIR += enscript-letterdj
SUBDIR += enscriptfonts
SUBDIR += envelope
SUBDIR += epsonepl
SUBDIR += font2svg
SUBDIR += foomatic-db
SUBDIR += foomatic-db-engine

33
print/epsonepl/Makefile Normal file
View File

@ -0,0 +1,33 @@
# New ports collection makefile for: epsonepl
# Date created: 14 February 2003
# Whom: Simon 'corecode' Schubert <corecode@corecode.ath.cx>
#
# $FreeBSD$
#
PORTNAME= epsonepl
PORTVERSION= 0.2.2
CATEGORIES= print
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ${PORTNAME}
DISTNAME= ${PORTNAME}ijs-${PORTVERSION}
EXTRACT_SUFX= .tgz
MAINTAINER= corecode@corecode.ath.cx
COMMENT= "Printer filter for EPSON EPL-5700L etc"
LIB_DEPENDS= ijs.1:${PORTSDIR}/print/libijs
RUN_DEPENDS= gs:${PORTSDIR}/print/ghostscript-gnu
MAKEFILE= ${FILESDIR}/Makefile
post-extract:
@cd ${WRKSRC} && ${LS} ijs* | ${GREP} -v ${PORTNAME} | ${XARGS} ${RM}
post-install:
@${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.conf.sample ${PREFIX}/etc
@${MKDIR} ${DATADIR}
@${INSTALL_DATA} ${FILESDIR}/${PORTNAME}.apsfilter ${DATADIR}
@${SED} -e 's#%%PREFIX%%#${PREFIX}#' ${PKGMESSAGE}
.include <bsd.port.mk>

1
print/epsonepl/distinfo Normal file
View File

@ -0,0 +1 @@
MD5 (epsoneplijs-0.2.2.tgz) = bc4a146ed84573b9f12a5a05916d74ae

View File

@ -0,0 +1,16 @@
# $FreeBSD$
DESTDIR= ${PREFIX}
BINDIR= /bin
CFLAGS+= -I${LOCALBASE}/include/ijs
LDADD= -L${LOCALBASE}/lib -lijs
PROG= ijs_server_epsonepl
SRCS= ijs_server_epsonepl.c epl_compress.c epl_job_footer.c epl_job_header.c \
epl_page_footer.c epl_page_header.c epl_print_stripe.c
SCRIPTS= ps2epl
NOMAN= yes
.include <bsd.prog.mk>

View File

@ -0,0 +1,17 @@
# apsfilter epson EPL5[789]00L driver
# just copy to ${LOCALBASE}/share/apsfilter/driver/epsonepl and add this line to
# ${LOCALBASE}/share/apsfilter/driver/MAPPING:
# +--------------------------------------+
# | epsonepl:EPL5700L:EPL5800L:EPL5900L: |
# +--------------------------------------+
case "$QUALITY" in
draft) params="EplDpi=300,EplRitech=off,EplTonerSave=on" RESOLUTION=300x300 ;;
low) params="EplDpi=300,EplRitech=off,EplTonerSave=off" RESOLUTION=300x300 ;;
medium) params="EplDpi=Class600,EplRitech=on,EplTonerSave=off" RESOLUTION=600x300 ;;
high) params="EplDpi=600,EplRitech=off,EplTonerSave=off" RESOLUTION=600x600 ;;
photo) params="EplDpi=Class1200,EplRitech=on,EplTonerSave=off" RESOLUTION=1200x600 ;;
esac
GS_FEATURES="$GS_FEATURES -sProcessColorModel=DeviceGray -dBitsPerSample=1 -sIjsServer=ijs_server_epsonepl -dIjsUseOutputFD -sIjsParams='$params,EplDensity=3' -sDeviceManufacturer=Epson -sDeviceModel=$(echo $PRINTER | sed 's#.*/##')"
PRINTER=ijs

View File

@ -0,0 +1,25 @@
# sample config file for epsonepl
# a hash sign starts a comment and counts as whitespace
#
# settings must be in the form of:
# [whitespace]<variable><whitespace_or_=><value>[whitespace]
#
# variable allowed values mandatory default
# -----------------------------------------------------------------------
# model EPL5700L EPL5800L EPL5900L yes -
# papersize see gs config yes -
# dpi 300 Class600 600 Class1200 no 600
# ritech on off no on
# density 1 2 3 4 5 no 3
# tonersave on off no off
#
# you can specify ps2epl to use another config file by spefifying
# -f<config> as the _first_ parameter, e.g.:
# ps2epl -f/path/to/my/config [other options and files]
#
model EPL5700L
papersize a4
dpi Class600
ritech on
density 3
tonersave off

View File

@ -0,0 +1,138 @@
--- ijs_server_epsonepl.c.orig Wed Jan 22 23:10:24 2003
+++ ijs_server_epsonepl.c Fri Feb 14 16:47:16 2003
@@ -34,7 +34,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <malloc.h>
#include "ijs.h"
#include "ijs_server.h"
@@ -541,7 +540,9 @@
/* Check options */
+#ifdef EPL_DEBUG
fprintf(stderr, "settings:\n");
+#endif
if (epl_job_info->outfile == NULL)
{
@@ -596,7 +597,10 @@
fprintf(stderr, "Unknown Printer %s, aborting!\n", s);
return 1;
}
+
+#ifdef EPL_DEBUG
fprintf(stderr, " Using protocol for %s\n",printername[epl_job_info->model]);
+#endif
/* PaperSize */
@@ -622,7 +626,9 @@
fprintf(stderr, "Unparsable PaperSize %s, aborting!", s);
return 1;
}
+#ifdef EPL_DEBUG
fprintf(stderr, " Papersize is %s inches\n", s);
+#endif
}
@@ -659,7 +665,10 @@
fprintf(stderr, "Unknown EplDpi value %s, aborting!\n", s);
return 1;
}
+
+#ifdef EPL_DEBUG
fprintf(stderr, " Printing at DPI %s\n", s);
+#endif
/* EplRitech */
s = find_param(pl, "EplRitech");
@@ -681,7 +690,10 @@
fprintf(stderr, "Unknown EplRitech value %s, aborting!\n", s);
return 1;
}
+
+#ifdef EPD_DEBUG
fprintf(stderr, " Ritech is %s\n", s);
+#endif
/* EplDensity */
s = find_param(pl, "EplDensity");
@@ -715,7 +727,10 @@
fprintf(stderr, "Unknown EplDensity value %s, aborting!\n", s);
return 1;
}
+
+#ifdef EPL_DEBUG
fprintf(stderr, " Density is %s\n", s);
+#endif
/* EplTonerSave */
s = find_param(pl, "EplTonerSave");
@@ -737,7 +752,10 @@
fprintf(stderr, "Unknown EplTonerSave value %s, aborting!\n", s);
return 1;
}
+
+#ifdef EPL_DEBUG
fprintf(stderr, " TonerSave is %s\n", s);
+#endif
/* Number of channels */
if (ph.bps != 1)
@@ -758,11 +776,13 @@
/* BitMap Size */
epl_job_info->pixel_h = ph.width;
epl_job_info->pixel_v = ph.height;
+#ifdef DEBUG
fprintf(stderr, " Bitmap size %ix%i (%gx%g in)\n",
epl_job_info->pixel_h,
epl_job_info->pixel_v,
(double)epl_job_info->pixel_h / epl_job_info->dpi_h,
(double)epl_job_info->pixel_v / epl_job_info->dpi_v);
+#endif
/* Dpi of the bitmap */
if (ph.xres != (double)epl_job_info->dpi_h
@@ -811,7 +831,7 @@
fprintf(stderr, "Try to allocate %i byte of memory for job info\n",sizeof(EPL_job_info));
#endif
- epl_job_info = (EPL_job_info *)malloc(sizeof(EPL_job_info));
+ epl_job_info = (EPL_job_info *)calloc(1, sizeof(EPL_job_info));
if (epl_job_info == NULL) {
#ifdef EPL_DEBUG
@@ -833,7 +853,9 @@
int i_stripe;
typ_stream *stream;
+#ifdef EPL_DEBUG
fprintf (stderr, "getting page header\n");
+#endif
status = ijs_server_get_page_header (ctx, &ph);
@@ -852,9 +874,10 @@
break;
}
+#ifdef EPL_DEBUG
fprintf (stderr, "got page header, width %d x height %d\n",
ph.width, ph.height);
-
+
/* Before starting, dump IJS parameters */
for (curs = pl; curs != NULL; curs = curs->next)
@@ -863,6 +886,7 @@
fwrite (curs->value, 1, curs->value_size, stderr);
fputs ("\n", stderr);
}
+#endif
/* Convert parameters to internal format */

View File

@ -0,0 +1,190 @@
--- ps2epl.orig Wed Jan 29 11:19:06 2003
+++ ps2epl Fri Feb 14 23:33:46 2003
@@ -1,11 +1,105 @@
#!/bin/sh
+parse() {
+if [ ! -r "$1" ]; then
+ echo "${BASENAME}: Can't read config file '$1'!" >&2
+ exit 1
+fi
+sed -e 's/#.*//;
+ /^[[:space:]]*$/d;
+ s/^[[:space:]]*//;
+ s/[[:space:]]*$//;
+ s/^\([^[:space:]=]*\)[[:space:]=]*\(.*\)/\1 \2/' "$1" |
+while read var value
+do
+ case `echo ${var} | tr '[[:upper:]]' '[[:lower:]]'` in
+ model)
+ case "${value}" in
+ EPL5[789]00L)
+ echo "MODEL='${value}'"
+ ;;
+ *)
+ echo "${BASENAME}: Unknown model '${value}'!" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+ papersize)
+ echo "PAPERSIZE='${value}'"
+ ;;
+ dpi)
+ case "${value}" in
+ 300|Class600|600|Class1200)
+ echo "DPI='${value}'"
+ ;;
+ *)
+ echo "${BASENAME}: Unknown resolution '${value}'!" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+ ritech)
+ case "${value}" in
+ on|off)
+ echo "RITECH='${value}'"
+ ;;
+ *)
+ echo "${BASENAME}: Unknown ritech setting '${value}'!" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+ density)
+ case "${value}" in
+ [12345])
+ echo "DENSITY='${value}'"
+ ;;
+ *)
+ echo "${BASENAME}: Unknown density setting '${value}'!" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+ tonersave)
+ case "${value}" in
+ on|off)
+ echo "TONERSAVE='${value}'"
+ ;;
+ *)
+ echo "${BASENAME}: Unknown tonersave setting '${value}'!" >&2
+ exit 1
+ ;;
+ esac
+ ;;
+ *)
+ echo "${BASENAME}: Unknown setting '${var}=${value}'!" >&2
+ exit 1
+ ;;
+ esac
+done
+}
+
+BASENAME=`basename $0`
+PREFIX=`dirname $0`
+PREFIX=${PREFIX%/bin}
+CONFIGFILE=${PREFIX}/etc/epsonepl.conf
+
+case "$1" in
+-f?*)
+ CONFIGFILE=${1#-f}
+ ;;
+esac
+
+settings=`parse "${CONFIGFILE}"` || exit 1
+eval "${settings}"
IJSPARMS=""
-# Start of printer selection part #########################################
+if [ -z "${MODEL}" ]; then
+ echo "${BASENAME}: You must specify a model!" >&2
+ exit 1
+fi
-MODEL=EPL5700L
# possible values: EPL5700L, EPL5800L, EPL5900L
# default: none, you have to specify a printer!
@@ -14,7 +108,10 @@
# Start of paper size selection part ######################################
-PAPERSIZE=a4
+if [ -z "${PAPERSIZE}" ]; then
+ echo "${BASENAME}: You must specify a papersize!" >&2
+ exit 1
+fi
# possible values: a4, letter, legal ...
# The full list is available in the Use.htm file of
# the ghostscript documentation (see appendix).
@@ -25,25 +122,29 @@
# Start of options part ###################################################
-DPI=600
+if [ -n "${DPI}" ]; then
# possible values: 300, Class600, 600, Class1200
# default: 600
IJSPARMS="EplDpi=$DPI"
+fi
-RITECH=on
+if [ -n "${RITECH}" ]; then
# possible values: on, off
# default: on
- IJSPARMS="$IJSPARMS,EplRitech=$RITECH"
+ IJSPARMS="$IJSPARMS${IJSPARMS:+,}EplRitech=$RITECH"
+fi
-DENSITY=3
+if [ -n "${DENSITY}" ]; then
# possible values: 1, 2, 3, 4, 5
# default: 3
- IJSPARMS="$IJSPARMS,EplDensity=$DENSITY"
+ IJSPARMS="$IJSPARMS${IJSPARMS:+,}EplDensity=$DENSITY"
+fi
-TONERSAVE=off
+if [ -n "${TONERSAVE}" ]; then
# possible values: on, off
# default: off
- IJSPARMS="$IJSPARMS,EplTonerSave=$TONERSAVE"
+ IJSPARMS="$IJSPARMS${IJSPARMS:+,}EplTonerSave=$TONERSAVE"
+fi
##################################################### End of options part #
@@ -63,7 +164,7 @@
done
if [ $# -lt 1 -o $# -gt 2 ]; then
- echo "Usage: `basename $0` [options...] (input.[e]ps|-) [output.epl|-]" 1>&2
+ echo "Usage: ${BASENAME} [-f<config>] [options...] (input.[e]ps|-) [output.epl|-]" 1>&2
exit 1
fi
@@ -81,19 +182,11 @@
outfile="$2"
fi
-echo
-echo -e "***** Printer: \"$MODEL\" *****"
-echo
-echo -e "***** Paper Size: \"$PAPERSIZE\" *****"
-echo
-echo -e "***** using parameters: \"$IJSPARMS\" *****"
-echo
-
exec gs -sPAPERSIZE=$PAPERSIZE -dFIXEDMEDIA \
-sProcessColorModel=DeviceGray -dBitsPerSample=1 \
-sDEVICE=ijs -sIjsServer=ijs_server_epsonepl \
-sDeviceManufacturer=Epson -sDeviceModel=$MODEL \
-sIjsParams="$IJSPARMS" \
-dIjsUseOutputFD \
--dNOPAUSE -dSAFER -dBATCH \
--sOutputFile=$outfile $infile
+-dQUIET -dNOPAUSE -dSAFER -dBATCH \
+-sOutputFile="$outfile" "$infile"

8
print/epsonepl/pkg-descr Normal file
View File

@ -0,0 +1,8 @@
This is a printer filter for the EPSON EPL-5700L, EPL-5800L and EPL-5900L
budget models of EPSON's laser printers.
This port also provides a driver for apsfilter.
WWW: http://epsonepl.sourceforge.net/
- Simon 'corecode' Schubert

View File

@ -0,0 +1,9 @@
-------------------------------------------------------------------------
You need to copy and customize
%%PREFIX%%/etc/epsonepl.conf[.sample]
If you're using apsfilter then have a look
at %%PREFIX%%/share/epsonepl/epsonepl.apsfilter
-------------------------------------------------------------------------

5
print/epsonepl/pkg-plist Normal file
View File

@ -0,0 +1,5 @@
bin/ijs_server_epsonepl
bin/ps2epl
etc/epsonepl.conf.sample
share/epsonepl/epsonepl.apsfilter
@dirrm share/epsonepl