Используйте сценарий в качестве принтера для обработки вывода (PDF)

Вы можете поместить следующую команду в ваш файл .bash_profile.

gnome-terminal --geometry=WIDTHxHEIGHT+XPOS+YPOS

В которой:

WIDTH - ширина символов HEIGHT - это высота в строках XPOS есть X-позитрон в пикселях YPOS - это Y-позиция в пикселях

Обратите внимание, что x отделяет WIDTH от HEIGHT. A + отделяет высоту от XPOS. Другой + отделяет XPOS от YPOS.

7
задан 28 November 2017 в 13:22

3 ответа

Ключи, кажется, находятся в первой ссылке в вашем вопросе. Исследования показывают, что бэкэнд - это всего лишь сценарии. Поэтому вы могли бы просто написать свой собственный. Однако, похоже, что сценарий, который вы ищете, который доступен для OpenSuse, описан в вашей первой ссылке.

Пакеты cups-backends пакета openSUSE RPM предоставляют сценарий bash / usr / lib / cups / backend / pipe, который является оберткой для печати в любой программе.

нахождение этого скрипта осложняется тем фактом, что OpenSuse теперь использует .ymp установщиков с одним кликом, и вам нужно немного углубиться, чтобы найти фактический .rpm, содержащий скрипт. Вот пример, взятый непосредственно из cups-backends-1.1-296.6.noarch.rpm, доступный здесь.

Открытие пакета с файловым роликом и переход на /./usr/lib/cups/backend/ в пакете и открытие pipe показывает скрипт ниже:

#! /bin/bash
# CUPS wrapper backend "pipe" for printing to any program.
# It forwards the print job data like a pipe into another command.
# Author: Johannes Meixner <jsmeix@suse.de>, 2009, 2014
# For basic information see "man 7 backend" and "man 7 filter".
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU GENERAL PUBLIC LICENSE Version 2
# as published by the Free Software Foundation.

# Activate the "set -x" line to get debugging info in /var/log/cups/error_log:
#set -x

# Output "Device Discovery" information on stdout:
if test "$#" = "0"
then
  echo 'direct pipe "Unknown" "Forward print job data like a pipe to another command"'
  exit 0
fi

# Output usage information in case of wrong number of parameters:
if test "$#" != "5" -a "$#" != "6"
then
  echo 'Usage: pipe job-id user title copies options [file]' 1>&2
  echo 'Queue setup example:' 1>&2
  echo 'lpadmin -p queue_name -v "pipe:/path/to/command?option1=value1&-option2&value2" -E' 1>&2
  echo 'The command is called with the specified options as:' 1>&2
  echo '/path/to/command option1=value1 -option2 value2' 1>&2
  echo 'The original command line parameters (... job-id user ...)' 1>&2
  echo 'are provided as environment variables PIPE_BACKEND_ARGV[0-6]' 1>&2
  exit 1
fi

# Keep the original command line parameters (... job-id user ...)
# in environment variables to make them available for the command:
export PIPE_BACKEND_ARGV0="$0"
export PIPE_BACKEND_ARGV1="$1"
export PIPE_BACKEND_ARGV2="$2"
export PIPE_BACKEND_ARGV3="$3"
export PIPE_BACKEND_ARGV4="$4"
export PIPE_BACKEND_ARGV5="$5"
export PIPE_BACKEND_ARGV6="$6"

# Have the input at fd0 (stdin) in any case:
if test -n "$6"
then
  exec <"$6"
fi

# To be on the safe side clip anything after the first space character
# because spaces are excluded characters in a URI (see RFC 2396):
URI=${DEVICE_URI%% *}
# Extract the command to which the job schould be sent from the URI.
# Clip the URI scheme (anything up to the first ':' character) and
# clip anything after the first '?' character
# because anything after the first '?' character are options:
COMMAND=${URI#*:}
COMMAND=${COMMAND%%\?*}
# Extract the options (e.g. from 'pipe:/path/to/command?option1=value1&-option2&value2'
# clip anything up to the first '?' character and
# replace the options separator '&' character by a space:
OPTIONS=${URI#*\?}
if test "$OPTIONS" = "$URI"
then
  OPTIONS=""
fi
OPTIONS=$( echo "$OPTIONS" | tr '&' ' ' )
# Options could have been specified in a wrong way
# as addendum to the DeviceURI separated by spaces
# (spaces are excluded characters in a URI, see RFC 2396)
# which works by luck at least for some CUPS versions
# see https://bugzilla.novell.com/show_bug.cgi?id=499735
# like 'pipe:/path/to/command option1=value1 -option2 value2'
# nevertheless use additionally those kind of options too:
MORE_OPTIONS=${DEVICE_URI#* }
if test "$MORE_OPTIONS" = "$DEVICE_URI"
then
  MORE_OPTIONS=""
fi
OPTIONS=$( echo "$OPTIONS" "$MORE_OPTIONS" | tr -s ' ' )

# Test if the command is executable:
if ! test -x "$COMMAND"
then
  echo "Cannot execute $COMMAND" 1>&2
  exit 1
fi

# Replace this wrapper with the actual command
# so that it exits with the exit code of the command
# and that the command gets any signals directly.
exec "$COMMAND" $OPTIONS

Поскольку это скрипт bash, вы можете использовать его с любой версией 'nix, включая Ubuntu, с оболочкой bash, а не только с Suse.

Чтобы добавить бэкэнд в чашки, вам нужно будет скопировать его на /usr/lib/cups/backend и здесь.

chown root:root /usr/lib/cups/backend/pipe

chmod 755 /usr/lib/cups/backend/pipe [ ! d10]

Источники:

https://www.cups.org/doc/man-backend.html

https: //www.cups. org / doc / man-backend.html

Как извлечь файл RPM?

5
ответ дан 22 May 2018 в 15:50

Ключи, кажется, находятся в первой ссылке в вашем вопросе. Исследования показывают, что бэкэнд - это всего лишь сценарии. Поэтому вы могли бы просто написать свой собственный. Однако, похоже, что сценарий, который вы ищете, который доступен для OpenSuse, описан в вашей первой ссылке.

Пакеты cups-backends пакета openSUSE RPM предоставляют сценарий bash / usr / lib / cups / backend / pipe, который является оберткой для печати в любой программе.

нахождение этого скрипта осложняется тем фактом, что OpenSuse теперь использует .ymp установщиков с одним кликом, и вам нужно немного углубиться, чтобы найти фактический .rpm, содержащий скрипт. Вот пример, взятый непосредственно из cups-backends-1.1-296.6.noarch.rpm, доступный здесь.

Открытие пакета с файловым роликом и переход на /./usr/lib/cups/backend/ в пакете и открытие pipe показывает скрипт ниже:

#! /bin/bash # CUPS wrapper backend "pipe" for printing to any program. # It forwards the print job data like a pipe into another command. # Author: Johannes Meixner <jsmeix@suse.de>, 2009, 2014 # For basic information see "man 7 backend" and "man 7 filter". # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU GENERAL PUBLIC LICENSE Version 2 # as published by the Free Software Foundation. # Activate the "set -x" line to get debugging info in /var/log/cups/error_log: #set -x # Output "Device Discovery" information on stdout: if test "$#" = "0" then echo 'direct pipe "Unknown" "Forward print job data like a pipe to another command"' exit 0 fi # Output usage information in case of wrong number of parameters: if test "$#" != "5" -a "$#" != "6" then echo 'Usage: pipe job-id user title copies options [file]' 1>&2 echo 'Queue setup example:' 1>&2 echo 'lpadmin -p queue_name -v "pipe:/path/to/command?option1=value1&-option2&value2" -E' 1>&2 echo 'The command is called with the specified options as:' 1>&2 echo '/path/to/command option1=value1 -option2 value2' 1>&2 echo 'The original command line parameters (... job-id user ...)' 1>&2 echo 'are provided as environment variables PIPE_BACKEND_ARGV[0-6]' 1>&2 exit 1 fi # Keep the original command line parameters (... job-id user ...) # in environment variables to make them available for the command: export PIPE_BACKEND_ARGV0="$0" export PIPE_BACKEND_ARGV1="$1" export PIPE_BACKEND_ARGV2="$2" export PIPE_BACKEND_ARGV3="$3" export PIPE_BACKEND_ARGV4="$4" export PIPE_BACKEND_ARGV5="$5" export PIPE_BACKEND_ARGV6="$6" # Have the input at fd0 (stdin) in any case: if test -n "$6" then exec <"$6" fi # To be on the safe side clip anything after the first space character # because spaces are excluded characters in a URI (see RFC 2396): URI=${DEVICE_URI%% *} # Extract the command to which the job schould be sent from the URI. # Clip the URI scheme (anything up to the first ':' character) and # clip anything after the first '?' character # because anything after the first '?' character are options: COMMAND=${URI#*:} COMMAND=${COMMAND%%\?*} # Extract the options (e.g. from 'pipe:/path/to/command?option1=value1&-option2&value2' # clip anything up to the first '?' character and # replace the options separator '&' character by a space: OPTIONS=${URI#*\?} if test "$OPTIONS" = "$URI" then OPTIONS="" fi OPTIONS=$( echo "$OPTIONS" | tr '&' ' ' ) # Options could have been specified in a wrong way # as addendum to the DeviceURI separated by spaces # (spaces are excluded characters in a URI, see RFC 2396) # which works by luck at least for some CUPS versions # see https://bugzilla.novell.com/show_bug.cgi?id=499735 # like 'pipe:/path/to/command option1=value1 -option2 value2' # nevertheless use additionally those kind of options too: MORE_OPTIONS=${DEVICE_URI#* } if test "$MORE_OPTIONS" = "$DEVICE_URI" then MORE_OPTIONS="" fi OPTIONS=$( echo "$OPTIONS" "$MORE_OPTIONS" | tr -s ' ' ) # Test if the command is executable: if ! test -x "$COMMAND" then echo "Cannot execute $COMMAND" 1>&2 exit 1 fi # Replace this wrapper with the actual command # so that it exits with the exit code of the command # and that the command gets any signals directly. exec "$COMMAND" $OPTIONS

Поскольку это скрипт bash, вы можете использовать его с любой версией 'nix, включая Ubuntu, с оболочкой bash, а не только с Suse.

Чтобы добавить бэкэнд в чашки, вам нужно будет скопировать его на /usr/lib/cups/backend и здесь.

chown root:root /usr/lib/cups/backend/pipe

chmod 755 /usr/lib/cups/backend/pipe [ ! d10]

Источники:

https://www.cups.org/doc/man-backend.html

https: //www.cups. org / doc / man-backend.html

Как извлечь файл RPM?

5
ответ дан 18 July 2018 в 02:26

Ключи, кажется, находятся в первой ссылке в вашем вопросе. Исследования показывают, что бэкэнд - это всего лишь сценарии. Поэтому вы могли бы просто написать свой собственный. Однако, похоже, что сценарий, который вы ищете, который доступен для OpenSuse, описан в вашей первой ссылке.

Пакеты cups-backends пакета openSUSE RPM предоставляют сценарий bash / usr / lib / cups / backend / pipe, который является оберткой для печати в любой программе.

нахождение этого скрипта осложняется тем фактом, что OpenSuse теперь использует .ymp установщиков с одним кликом, и вам нужно немного углубиться, чтобы найти фактический .rpm, содержащий скрипт. Вот пример, взятый непосредственно из cups-backends-1.1-296.6.noarch.rpm, доступный здесь.

Открытие пакета с файловым роликом и переход на /./usr/lib/cups/backend/ в пакете и открытие pipe показывает скрипт ниже:

#! /bin/bash # CUPS wrapper backend "pipe" for printing to any program. # It forwards the print job data like a pipe into another command. # Author: Johannes Meixner <jsmeix@suse.de>, 2009, 2014 # For basic information see "man 7 backend" and "man 7 filter". # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU GENERAL PUBLIC LICENSE Version 2 # as published by the Free Software Foundation. # Activate the "set -x" line to get debugging info in /var/log/cups/error_log: #set -x # Output "Device Discovery" information on stdout: if test "$#" = "0" then echo 'direct pipe "Unknown" "Forward print job data like a pipe to another command"' exit 0 fi # Output usage information in case of wrong number of parameters: if test "$#" != "5" -a "$#" != "6" then echo 'Usage: pipe job-id user title copies options [file]' 1>&2 echo 'Queue setup example:' 1>&2 echo 'lpadmin -p queue_name -v "pipe:/path/to/command?option1=value1&-option2&value2" -E' 1>&2 echo 'The command is called with the specified options as:' 1>&2 echo '/path/to/command option1=value1 -option2 value2' 1>&2 echo 'The original command line parameters (... job-id user ...)' 1>&2 echo 'are provided as environment variables PIPE_BACKEND_ARGV[0-6]' 1>&2 exit 1 fi # Keep the original command line parameters (... job-id user ...) # in environment variables to make them available for the command: export PIPE_BACKEND_ARGV0="$0" export PIPE_BACKEND_ARGV1="$1" export PIPE_BACKEND_ARGV2="$2" export PIPE_BACKEND_ARGV3="$3" export PIPE_BACKEND_ARGV4="$4" export PIPE_BACKEND_ARGV5="$5" export PIPE_BACKEND_ARGV6="$6" # Have the input at fd0 (stdin) in any case: if test -n "$6" then exec <"$6" fi # To be on the safe side clip anything after the first space character # because spaces are excluded characters in a URI (see RFC 2396): URI=${DEVICE_URI%% *} # Extract the command to which the job schould be sent from the URI. # Clip the URI scheme (anything up to the first ':' character) and # clip anything after the first '?' character # because anything after the first '?' character are options: COMMAND=${URI#*:} COMMAND=${COMMAND%%\?*} # Extract the options (e.g. from 'pipe:/path/to/command?option1=value1&-option2&value2' # clip anything up to the first '?' character and # replace the options separator '&' character by a space: OPTIONS=${URI#*\?} if test "$OPTIONS" = "$URI" then OPTIONS="" fi OPTIONS=$( echo "$OPTIONS" | tr '&' ' ' ) # Options could have been specified in a wrong way # as addendum to the DeviceURI separated by spaces # (spaces are excluded characters in a URI, see RFC 2396) # which works by luck at least for some CUPS versions # see https://bugzilla.novell.com/show_bug.cgi?id=499735 # like 'pipe:/path/to/command option1=value1 -option2 value2' # nevertheless use additionally those kind of options too: MORE_OPTIONS=${DEVICE_URI#* } if test "$MORE_OPTIONS" = "$DEVICE_URI" then MORE_OPTIONS="" fi OPTIONS=$( echo "$OPTIONS" "$MORE_OPTIONS" | tr -s ' ' ) # Test if the command is executable: if ! test -x "$COMMAND" then echo "Cannot execute $COMMAND" 1>&2 exit 1 fi # Replace this wrapper with the actual command # so that it exits with the exit code of the command # and that the command gets any signals directly. exec "$COMMAND" $OPTIONS

Поскольку это скрипт bash, вы можете использовать его с любой версией 'nix, включая Ubuntu, с оболочкой bash, а не только с Suse.

Чтобы добавить бэкэнд в чашки, вам нужно будет скопировать его на /usr/lib/cups/backend и здесь.

chown root:root /usr/lib/cups/backend/pipe

chmod 755 /usr/lib/cups/backend/pipe [ ! d10]

Источники:

https://www.cups.org/doc/man-backend.html

https: //www.cups. org / doc / man-backend.html

Как извлечь файл RPM?

5
ответ дан 24 July 2018 в 17:34

Другие вопросы по тегам:

Похожие вопросы: