From f4092abdf94af6a99aff944d6264bc1284e8bdd4 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 10 Oct 2011 17:43:39 +0200 Subject: Imported nx-X11-3.1.0-1.tar.gz Summary: Imported nx-X11-3.1.0-1.tar.gz Keywords: Imported nx-X11-3.1.0-1.tar.gz into Git repository --- .../C/print/models/PS2PDFspooldir-GS/Imakefile | 35 ++++++ .../C/print/models/PS2PDFspooldir-GS/model-config | 72 ++++++++++++ .../models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh | 130 +++++++++++++++++++++ 3 files changed, 237 insertions(+) create mode 100644 nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/Imakefile create mode 100644 nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/model-config create mode 100755 nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh (limited to 'nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS') diff --git a/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/Imakefile b/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/Imakefile new file mode 100644 index 000000000..14f9ee59f --- /dev/null +++ b/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/Imakefile @@ -0,0 +1,35 @@ +XCOMM $Xorg: Imakefile,v 1.1 2003/11/20 03:42:52 gisburn Exp $ + +XPMODELNAME = PS2PDFspooldir-GS + +MODELDIR = $(XPRINTDIR)/C/print/models/$(XPMODELNAME) + +#if BuildGISWxprintglue || BuildGISWxprint +XCOMM Hack for Solaris's native /usr/openwin/bin/Xprt which does not +XCOMM understand the new %xpconfigdir% modelconfig variable +XCOMM (this is only used for the GISWxprintglue package build; +XCOMM the GISWxprint does not need it but using it avoids confusion +XCOMM if someone uses GISWxprint to run both Solaris native Xprt and +XCOMM our own binary side-by-side using the same config) +all:: model-config.SolarisXprt + +model-config.SolarisXprt: model-config + nawk model-config.SolarisXprt + +clean:: + $(RM) model-config.SolarisXprt + +InstallNamedNonExec(model-config.SolarisXprt,model-config,$(MODELDIR)) +#else +InstallNonExecFile(model-config,$(MODELDIR)) +#endif /* BuildGISWxprintglue || BuildGISWxprint */ + +InstallNamedProg(ps2pdf_spooltodir.sh,ps2pdf_spooltodir.sh,$(MODELDIR)) + +# All printer models which use GhostScript for filtering should use the +# printer-builtin fonts from the "GSdefault" printer model +# (unless they employ more or other builtin fonts) +install:: + $(RM) $(DESTDIR)$(MODELDIR)/fonts + $(LN) ../GSdefault/fonts $(DESTDIR)$(MODELDIR) + diff --git a/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/model-config b/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/model-config new file mode 100644 index 000000000..1d74b8676 --- /dev/null +++ b/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/model-config @@ -0,0 +1,72 @@ +# $Xprint.org: PS2PDFspooldir-GS model-config,v 1.1 2003/11/20 03:48:04 gisburn Exp $ +# PostScript DDX model-config which converts jobs to PDF via GhostScript's "ps2pdf" +# and then sends them to a spool dir instead to a print queue +# +# This model is basically a cut-down GSdefault model with a custom *xp-spooler-command +# +# DO NOT MODIFY THIS FILE!! +# +# If you want to make customisations for your printer create a copy +# of this printer model. +# Example (for creating a model config "MYCOMPANYlaserxx"): +# 1. Create model config dir: +# % mkdir MYCOMPANYlaserxx +# 2. Link (or copy) the PMF (printer font metrics) for the +# printer buildin fonts: +# % ln -s PS2PDFspooldir-GS/fonts MYCOMPANYlaserxx/. +# 3. Copy the model config file: +# % cp PS2PDFspooldir-GS/model-config MYCOMPANYlaserxx/. +# 4. Customize MYCOMPANYlaserxx/model-config to match your needs. +# +# Attributes supported for this printer model +*content-orientations-supported: portrait landscape reverse-portrait reverse-landscape +*descriptor: PDF job spool dir /tmp/Xprintjobs +*document-formats-supported: {POSTSCRIPT 2} +*input-trays-supported: +*medium-source-sizes-supported: \ +{ '' \ + {na-letter FALSE {6.35 209.55 6.35 273.05}}\ + {na-legal FALSE {6.35 209.55 6.35 349.25}}\ + {executive FALSE {6.35 177.80 6.35 260.35}}\ + {ledger FALSE {6.35 273.05 6.35 425.45}}\ + {quarto FALSE {6.35 209.55 6.35 268.732}}\ + {iso-a3 FALSE {6.35 290.65 6.35 413.65}}\ + {iso-a4 FALSE {6.35 203.65 6.35 290.65}}\ + {iso-a5 FALSE {6.35 141.65 6.35 203.65}}\ + {iso-b3 FALSE {6.35 346.65 6.35 493.65}}\ + {iso-b4 FALSE {6.35 243.65 6.35 346.65}}\ + {iso-b5 FALSE {6.35 169.65 6.35 243.65}}\ + {jis-b3 FALSE {6.35 357.65 6.35 508.65}}\ + {jis-b4 FALSE {6.35 250.65 6.35 357.65}}\ + {jis-b5 FALSE {6.35 175.65 6.35 250.65}}\ + {iso-c3 FALSE {6.35 317.65 6.35 451.65}}\ + {iso-c4 FALSE {6.35 222.65 6.35 317.65}}\ + {iso-c5 FALSE {6.35 155.65 6.35 222.65}}\ +} + +*plexes-supported: simplex duplex tumble +*printer-model: "PDF job spool dir /tmp/Xprintjobs" +# 75, 100, 120, 150, 180, 200, 240, 300, 360, 400, 600, 720, +# 940, 1200 and 2440 are supported DPI values, we limit it here +# to some common values: +*printer-resolutions-supported: 300 360 400 600 +*xp-ddx-identifier: XP-POSTSCRIPT +*xp-listfonts-modes-supported: xp-list-internal-printer-fonts xp-list-glyph-fonts +*xp-embedded-formats-supported: {POSTSCRIPT 2} +*xp-raw-formats-supported: {POSTSCRIPT 2} +*xp-setup-proviso: setup-optional + +# Use custom spooler script which sends the output to a dir instead to a printer queue +# Note that "%xpconfigdir%" is currently only supported in Xprt servers build +# from xprint.mozdev.org sources, other platforms have replace it with the +# absolute path name to the script +*xp-spooler-command: %xpconfigdir%/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh -d /tmp/Xprintjobs -s .pdf -u 077 -p %printer-name% -c %copy-count% -t %job-name% -o "%options%" + +# NOTE: xp-psddx-* attributes are EXPERIMENTAL for now. +# xp-psddx-download-fonts defines which fonts should be downloaded as outlines +# (valid types are "pfa", "pfb", "ttf", "ttc", "otf", "otc") +*xp-psddx-download-fonts: pfa pfb ttf ttc otf otc +# xp-psddx-download-font-type defines which font type is used to download outlines +# (valid values are "bitmap", "pstype1" and "pstype3") +*xp-psddx-download-font-type: pstype1 +# EOF. diff --git a/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh b/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh new file mode 100755 index 000000000..5739807d8 --- /dev/null +++ b/nx-X11/programs/Xserver/XpConfig/C/print/models/PS2PDFspooldir-GS/ps2pdf_spooltodir.sh @@ -0,0 +1,130 @@ +#!/bin/sh +PATH=/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/bin +export PATH + +verbose_msgs="false" +DEFAULT_SPOOLDIR=/tmp/Xprintjobs + +usage() +{ + printf "Usage: ${0}: [options]\n" + printf "-v\tbe verbose\n" + printf "-d dirname\tdefine spool dir\n" + printf "-p string\tname of printer selected by user\n" + printf "-c integer\tnumber of copies\n" + printf "-t string\tjob title\n" + printf "-s string\tfile name suffix\n" + printf "-o string\tspooler options\n" + printf "-u mask\tpermission mask for new files (see umask)\n" + exit 2 +} + +verbose() +{ + if ${verbose_msgs} ; then + echo "$1" + fi +} + +spooldir="${DEFAULT_SPOOLDIR}" +printername= +num_job_copies= +job_title= +filename_suffix= +spooler_options= +permmask= +while getopts va:b:d:p:c:t:s:o:u: i +do + case $i in + v) + verbose_msgs="true" + ;; + d) + spooldir="$OPTARG" + ;; + p) + printername="$OPTARG" + ;; + c) + num_job_copies="$OPTARG" + ;; + t) + job_title="$OPTARG" + ;; + s) + filename_suffix="$OPTARG" + ;; + o) + spooler_options="$OPTARG" + ;; + u) + permmask="$OPTARG" + ;; + ?) usage + ;; + esac +done + +verbose "# spooldir=\"$spooldir\"" +verbose "# printername=\"$printername\"" +verbose "# num_job_copies=\"$num_job_copies\"" +verbose "# job_title=\"$job_title\"" +verbose "# spooler_options=\"$spooler_options\"" +verbose "# umask=\"$permmask\"" + +if [ ! -d "${DEFAULT_SPOOLDIR}" ] ; then + mkdir "${DEFAULT_SPOOLDIR}" + chmod a+rwxt "${DEFAULT_SPOOLDIR}" +fi + +if [ "${permmask}" != "" ] ; then + umask ${permmask} +fi + +if [ ! -d "$spooldir" ] ; then + echo "$0: spooldir \"$spooldir\" does not exits." >&2 + exit 1 +fi +if [ ! -w "$spooldir" ] ; then + echo "$0: Cannot write to spooldir \"$spooldir\"." >&2 + exit 1 +fi + +# Create first part of the output file name (prefix and an "unique" +# id(=date and time))... +filename="Xpjob_`date +%Y%m%d%H%M%S`" + +# ... then add options ... +if [ "${printername}" != "" ] ; then + filename="${filename}_${printername}" +fi +if [ "${num_job_copies}" != "" -a "${num_job_copies}" != "1" ] ; then + filename="${filename}_copies_${num_job_copies}" +fi +if [ "${job_title}" != "" ] ; then + filename="${filename}_title_${job_title}" +fi + +# ... mangle output file name and filter chars (like whitespaces) +# which may screw-up further processing by other shell scripts ... +filename="`echo \"${filename}\" | tr '[:blank:]' '_' | tr -c -d '[:alnum:]_.-'`" + +# ... add path and suffix ... +filename="${spooldir}/${filename}${filename_suffix}" + +verbose "# File name is \"$filename\"." + +# ... and finally capture stdin to the file (we are using "gs" directly to +# avoid the problem that "ps2pdf" is not available in all Linux +# distributions by default). +#ps2pdf - - | cat >"${filename}" +gs -q -dNOPAUSE -dBATCH -sDEVICE=pdfwrite "-sOutputFile=-" -dCompatibilityLevel=1.2 -c .setpdfwrite -f - | cat >"${filename}" + +if ${verbose_msgs} ; then + printf "# File is " ; ls -l "${filename}" +fi + +verbose "# Done." + +exit 0 +# EOF. -- cgit v1.2.3