From 08fd3702ad61db9b726954262beada15be89c09f Mon Sep 17 00:00:00 2001 From: Reuben Thomas Date: Thu, 2 Jan 2020 20:48:37 +0000 Subject: [PATCH] Generate man pages using help2man (fix #13) Also use say instead of print where possible in scripts. Change to output --help and usage messages on stdout rather than stderr. --- .gitignore | 1 + .travis.yml | 7 + Makefile.am | 9 + configure.ac | 9 +- epsffit-include.man | 7 + epsffit.1 | 47 ----- epsffit.in.in | 16 +- extractres.1 => extractres-include.man | 28 +-- extractres.in.in | 7 +- includeres.1 => includeres-include.man | 22 +-- includeres.in.in | 11 +- m4/ax_check_gnu_make.m4 | 95 ++++++++++ man-include.man | 11 ++ psbook-include.man | 14 ++ psbook.1 | 39 ---- psbook.in.in | 8 +- psjoin-include.man | 2 + psjoin.1 | 18 -- psjoin.in.in | 10 +- psnup-include.man | 33 ++++ psnup.1 | 123 ------------- psnup.in.in | 28 ++- psresize-include.man | 17 ++ psresize.1 | 61 ------- psresize.in.in | 10 +- psselect-include.man | 8 + psselect.1 | 79 --------- psselect.in.in | 8 +- pstops-include.man | 146 +++++++++++++++ pstops.1 | 235 ------------------------- pstops.in.in | 60 +++---- 31 files changed, 461 insertions(+), 708 deletions(-) create mode 100644 epsffit-include.man delete mode 100644 epsffit.1 rename extractres.1 => extractres-include.man (57%) rename includeres.1 => includeres-include.man (64%) create mode 100644 m4/ax_check_gnu_make.m4 create mode 100644 man-include.man create mode 100644 psbook-include.man delete mode 100644 psbook.1 create mode 100644 psjoin-include.man delete mode 100644 psjoin.1 create mode 100644 psnup-include.man delete mode 100644 psnup.1 create mode 100644 psresize-include.man delete mode 100644 psresize.1 create mode 100644 psselect-include.man delete mode 100644 psselect.1 create mode 100644 pstops-include.man delete mode 100644 pstops.1 diff --git a/.gitignore b/.gitignore index b8d5bf6..b75e1c8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ *.o +*.1 *~ psutils*.tar.gz /.deps/ diff --git a/.travis.yml b/.travis.yml index 7b66b23..0672fe6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,12 @@ # Use language: c because perl builds are not available on macOS language: c +addons: + homebrew: + packages: + - help2man + update: true + matrix: include: - os: linux @@ -8,6 +14,7 @@ matrix: apt: packages: - libipc-run3-perl + - help2man - os: osx env: diff --git a/Makefile.am b/Makefile.am index ac77236..bdd3e21 100644 --- a/Makefile.am +++ b/Makefile.am @@ -71,6 +71,15 @@ install-exec-hook: mv $(DESTDIR)$(bindir)/paper $(DESTDIR)$(bindir)/paper$(PERL_EXEEXT); \ fi +%.1: % %-include.man man-include.man +## Exit gracefully if $@ is not writeable, such as during distcheck! + $(AM_V_GEN)if ( touch $@.w && rm -f $@.w; ) >/dev/null 2>&1; then \ + $(srcdir)/pre-inst-env $(top_srcdir)/build-aux/missing --run $(HELP2MAN) --no-info \ + --include=$(srcdir)/man-include.man \ + --include=$(srcdir)/$*-include.man \ + --output=$@ ./$*; \ + fi + include tests/Makefile.am loc: diff --git a/configure.ac b/configure.ac index e284f91..cb9851c 100644 --- a/configure.ac +++ b/configure.ac @@ -3,12 +3,19 @@ AC_INIT(psutils, 1.92, rrt@sc3d.org) AC_CONFIG_AUX_DIR([build-aux]) -AM_INIT_AUTOMAKE([-Wall -Werror foreign 1.11]) +AM_INIT_AUTOMAKE([-Wall foreign 1.11]) gl_EARLY gl_INIT AC_PATH_PROG(PERL, perl) +# Require GNU Make +AX_CHECK_GNU_MAKE([], [AC_MSG_ERROR([make must be GNU Make])]) + +# help2man +# Set a value even if not found, so that an invocation via build-aux/missing works +AC_PATH_PROG([HELP2MAN], [help2man], [help2man]) + # Generate output files AC_CONFIG_FILES([ Makefile diff --git a/epsffit-include.man b/epsffit-include.man new file mode 100644 index 0000000..f22d008 --- /dev/null +++ b/epsffit-include.man @@ -0,0 +1,7 @@ +[NAME] +epsffit - fit an Encapsulated PostScript file to a given bounding box + +/reads from standard input/ +See +.BR psutils (1) +for the available units. diff --git a/epsffit.1 b/epsffit.1 deleted file mode 100644 index b039c8f..0000000 --- a/epsffit.1 +++ /dev/null @@ -1,47 +0,0 @@ -.TH EPSFFIT 1 "PSUtils" -.SH NAME -epsffit \- fit encapsulated PostScript file (EPSF) into constrained size -.SH SYNOPSIS -.B epsffit -.RB [ \-c ] -.RB [ \-r ] -.RB [ \-a ] -.RB [ \-m ] -.RB [ \-s ] -.I llx lly urx ury -.RI [ infile -.RI [ outfile ]] -.SH DESCRIPTION -.B Epsffit -fits an EPSF file (encapsulated PostScript) to a given bounding box. -The coordinates of the box are given by -.RI ( llx , lly ) -for the lower left, and -.RI ( urx , ury ) -for the upper right (see -.BR psutils (1) -for the available units). -.PP -If no input or output files are specified, -.B epsffit -reads from the standard input and writes to the standard output. -.SH OPTIONS -.IP \fB\-c\fP 1i -Center the image in the given bounding box. -.IP \fB\-r\fP 1i -Rotate the image by 90 degrees counter-clockwise. -.IP \fB\-a\fP 1i -Adjust the aspect ratio to fit the bounding box. -The default is to preserve the aspect ratio. -.IP \fB\-m\fP 1i -Rotates the image to maximize the size if it would fit the specified bounding -box better. -.IP \fB\-s\fP 1i -Add a \fB/showpage\fP at the end of the file to force the image to print. -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. diff --git a/epsffit.in.in b/epsffit.in.in index 886a1d5..cf91a2c 100644 --- a/epsffit.in.in +++ b/epsffit.in.in @@ -2,7 +2,7 @@ # -*- perl -*- my $version_banner = < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag; diff --git a/extractres.1 b/extractres-include.man similarity index 57% rename from extractres.1 rename to extractres-include.man index a932fd7..2ceb303 100644 --- a/extractres.1 +++ b/extractres-include.man @@ -1,12 +1,8 @@ -.TH EXTRACTRES 1 "PSUtils" -.SH NAME -extractres \- filter to extract resources from a PostScript document -.SH SYNOPSIS -.B extractres -.RB [ \-m ] -.RI < document.ps -.RI > output.ps -.SH DESCRIPTION +[NAME] +extractres - filter to extract resources from a PostScript document + +[>DESCRIPTION] +.PP .B Extractres extracts resources (fonts, procsets, patterns, files, etc) appearing in a PostScript document, and puts appropriate @@ -27,18 +23,8 @@ The output file can then be put through page re-arrangement filters such as or .B pstops safely. -.PP -The -.B \-m -option combines the resources of the same name into one file; this must be -used for some programs which download fonts a bit at a time. -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. + +[>AUTHOR] .SH BUGS .B extractres does not alter the diff --git a/extractres.in.in b/extractres.in.in index 7a1434c..c159b64 100644 --- a/extractres.in.in +++ b/extractres.in.in @@ -71,11 +71,12 @@ my ($help_flag, $version_flag, $merge); sub usage { my ($exit_code) = @_; - print STDERR < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag; diff --git a/includeres.1 b/includeres-include.man similarity index 64% rename from includeres.1 rename to includeres-include.man index c87c150..4983e77 100644 --- a/includeres.1 +++ b/includeres-include.man @@ -1,11 +1,8 @@ -.TH INCLUDERES 1 "PSUtils" -.SH NAME -includeres \- filter to include resources in a PostScript document -.SH SYNOPSIS -.B includeres -.RI < document.ps -.RI > output.ps -.SH DESCRIPTION +[NAME] +includeres - filter to include resources in a PostScript document + +[>DESCRIPTION] +.PP .B Includeres includes resources (fonts, procsets, patterns, files, etc.) in place of .B %%IncludeResource @@ -24,13 +21,8 @@ The output file can then be put through page re-arrangement filters such as or .B pstops safely. -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. + +[>AUTHOR] .SH BUGS .B includeres does not alter the diff --git a/includeres.in.in b/includeres.in.in index baf0e5e..7e2c2f6 100644 --- a/includeres.in.in +++ b/includeres.in.in @@ -31,6 +31,7 @@ END # # AJCD 4/4/95 +use v5.10; use strict; use warnings; @@ -71,8 +72,8 @@ my ($help_flag, $version_flag); sub usage { my ($exit_code) = @_; - print STDERR < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag; @@ -107,8 +108,8 @@ while (<$infile>) { print $outfile do { local $/; }; close(RES); } else { - print $outfile "%%IncludeResource: ", join(" ", $type, @res), "\n"; - print STDERR "$prog: resource `$name' not found\n"; + say $outfile "%%IncludeResource: ", join(" ", $type, @res); + say STDERR "$prog: resource `$name' not found"; } } else { print $outfile $_; diff --git a/m4/ax_check_gnu_make.m4 b/m4/ax_check_gnu_make.m4 new file mode 100644 index 0000000..785dc96 --- /dev/null +++ b/m4/ax_check_gnu_make.m4 @@ -0,0 +1,95 @@ +# =========================================================================== +# https://www.gnu.org/software/autoconf-archive/ax_check_gnu_make.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_GNU_MAKE([run-if-true],[run-if-false]) +# +# DESCRIPTION +# +# This macro searches for a GNU version of make. If a match is found: +# +# * The makefile variable `ifGNUmake' is set to the empty string, otherwise +# it is set to "#". This is useful for including a special features in a +# Makefile, which cannot be handled by other versions of make. +# * The makefile variable `ifnGNUmake' is set to #, otherwise +# it is set to the empty string. This is useful for including a special +# features in a Makefile, which can be handled +# by other versions of make or to specify else like clause. +# * The variable `_cv_gnu_make_command` is set to the command to invoke +# GNU make if it exists, the empty string otherwise. +# * The variable `ax_cv_gnu_make_command` is set to the command to invoke +# GNU make by copying `_cv_gnu_make_command`, otherwise it is unset. +# * If GNU Make is found, its version is extracted from the output of +# `make --version` as the last field of a record of space-separated +# columns and saved into the variable `ax_check_gnu_make_version`. +# * Additionally if GNU Make is found, run shell code run-if-true +# else run shell code run-if-false. +# +# Here is an example of its use: +# +# Makefile.in might contain: +# +# # A failsafe way of putting a dependency rule into a makefile +# $(DEPEND): +# $(CC) -MM $(srcdir)/*.c > $(DEPEND) +# +# @ifGNUmake@ ifeq ($(DEPEND),$(wildcard $(DEPEND))) +# @ifGNUmake@ include $(DEPEND) +# @ifGNUmake@ else +# fallback code +# @ifGNUmake@ endif +# +# Then configure.in would normally contain: +# +# AX_CHECK_GNU_MAKE() +# AC_OUTPUT(Makefile) +# +# Then perhaps to cause gnu make to override any other make, we could do +# something like this (note that GNU make always looks for GNUmakefile +# first): +# +# if ! test x$_cv_gnu_make_command = x ; then +# mv Makefile GNUmakefile +# echo .DEFAULT: > Makefile ; +# echo \ $_cv_gnu_make_command \$@ >> Makefile; +# fi +# +# Then, if any (well almost any) other make is called, and GNU make also +# exists, then the other make wraps the GNU make. +# +# LICENSE +# +# Copyright (c) 2008 John Darrington +# Copyright (c) 2015 Enrico M. Crisostomo +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 12 + +AC_DEFUN([AX_CHECK_GNU_MAKE],dnl + [AC_PROG_AWK + AC_CACHE_CHECK([for GNU make],[_cv_gnu_make_command],[dnl + _cv_gnu_make_command="" ; +dnl Search all the common names for GNU make + for a in "$MAKE" make gmake gnumake ; do + if test -z "$a" ; then continue ; fi ; + if "$a" --version 2> /dev/null | grep GNU 2>&1 > /dev/null ; then + _cv_gnu_make_command=$a ; + AX_CHECK_GNU_MAKE_HEADLINE=$("$a" --version 2> /dev/null | grep "GNU Make") + ax_check_gnu_make_version=$(echo ${AX_CHECK_GNU_MAKE_HEADLINE} | ${AWK} -F " " '{ print $(NF); }') + break ; + fi + done ;]) +dnl If there was a GNU version, then set @ifGNUmake@ to the empty string, '#' otherwise + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifGNUmake], ["#"])], [AS_VAR_SET([ifGNUmake], [""])]) + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_VAR_SET([ifnGNUmake], [""])], [AS_VAR_SET([ifnGNUmake], ["#"])]) + AS_VAR_IF([_cv_gnu_make_command], [""], [AS_UNSET(ax_cv_gnu_make_command)], [AS_VAR_SET([ax_cv_gnu_make_command], [${_cv_gnu_make_command}])]) + AS_VAR_IF([_cv_gnu_make_command], [""],[$2],[$1]) + AC_SUBST([ifGNUmake]) + AC_SUBST([ifnGNUmake]) +]) diff --git a/man-include.man b/man-include.man new file mode 100644 index 0000000..3ab6100 --- /dev/null +++ b/man-include.man @@ -0,0 +1,11 @@ +[AUTHOR] +Written by Angus J. C. Duggan and Reuben Thomas. + +[>COPYRIGHT] +.SH TRADEMARKS +.B PostScript +is a trademark of Adobe Systems Incorporated. + +[SEE ALSO] +.BR psutils (1), +.BR paper (1) diff --git a/psbook-include.man b/psbook-include.man new file mode 100644 index 0000000..50699cf --- /dev/null +++ b/psbook-include.man @@ -0,0 +1,14 @@ +[NAME] +psbook - rearrange pages in PostScript file into signatures + +[>DESCRIPTION] +.PP +.B Psbook +uses +.B Pstops +to rearrange pages from a PostScript document into \[oq]signatures\[cq] for +printing books or booklets, creating a new PostScript file. +The signature size is the number of sides which will be folded and bound +together; the number given should be a multiple of four. +Extra blank sides will be added if the file does not contain a multiple of +four pages. diff --git a/psbook.1 b/psbook.1 deleted file mode 100644 index 0602404..0000000 --- a/psbook.1 +++ /dev/null @@ -1,39 +0,0 @@ -.TH PSBOOK 1 "PSUtils" -.SH NAME -psbook \- rearrange pages in PostScript file into signatures -.SH SYNOPSIS -.B psbook -.RB [ \-q ] -.RB [ \-s\fIsignature\fR ] -.RI [ infile -.RI [ outfile ]] -.SH DESCRIPTION -.B Psbook -rearranges pages from a PostScript document into \[oq]signatures\[cq] for -printing books or booklets, creating a new PostScript file. -The input PostScript file should follow the Adobe Document Structuring -Conventions. -.PP -The -.B \-s -option selects the size of signature which will be used. -The signature size is the number of sides which will be folded and bound -together; the number given should be a multiple of four. -The default is zero, which means to use one signature for the whole file. -Extra blank sides will be added if the file does not contain a multiple of -four pages. -.PP -.B Psbook -normally prints the page numbers of the pages rearranged; the -.B \-q -option suppresses this. -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. -.SH BUGS -.B Psbook -does not accept all DSC comments. diff --git a/psbook.in.in b/psbook.in.in index ab777d4..15ee963 100644 --- a/psbook.in.in +++ b/psbook.in.in @@ -2,7 +2,7 @@ # -*- perl -*- my $version_banner = < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag; diff --git a/psjoin-include.man b/psjoin-include.man new file mode 100644 index 0000000..25974d2 --- /dev/null +++ b/psjoin-include.man @@ -0,0 +1,2 @@ +[NAME] +psjoin - concatenate PostScript files diff --git a/psjoin.1 b/psjoin.1 deleted file mode 100644 index c64c2ec..0000000 --- a/psjoin.1 +++ /dev/null @@ -1,18 +0,0 @@ -.TH PSJOIN "1" "November 2003" "psjoin" "User Commands" -.SH NAME -psjoin \- psjoin -.SH SYNOPSIS -.B psjoin -.RI [ option ...] -.IR filename ... -.SH DESCRIPTION -.B psjoin -\- concatenate PostScript files -by Tom Sato , http://member.nifty.ne.jp/tsato/ -.SS "Option:" -.HP -\fB\-e\fR: force page of each document to an odd page -.HP -\fB\-s\fR: try to close unclosed save operators -.HP -\fB\-p\fR: do not omit the prolog/trailer of the input files diff --git a/psjoin.in.in b/psjoin.in.in index 84138d9..096ebe4 100644 --- a/psjoin.in.in +++ b/psjoin.in.in @@ -2,8 +2,8 @@ # -*- perl -*- my $version_banner = < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag or $#ARGV == -1; diff --git a/psnup-include.man b/psnup-include.man new file mode 100644 index 0000000..f0c481e --- /dev/null +++ b/psnup-include.man @@ -0,0 +1,33 @@ +[NAME] +psnup - multiple pages per sheet + +[>DESCRIPTION] +.PP +.B Psnup +uses +.B Pstops +to impose multiple logical pages on to each physical sheet of paper. +.PP +Paper sizes can be given either as a name (see +.BR paper(1) ) +or as \fBwidth\fRx\fBheight\fR (see +.BR psutils (1) +for the available units). + +[EXAMPLES] +The potential use of this utility is varied but one particular +use is in conjunction with +.BR psbook (1). +For example, using groff to create a PostScript document and lpr as +the +.SM UNIX +print spooler a typical command line might look like this: +.sp +groff -Tps -ms \fIfile\fP | psbook | psnup -2 | lpr +.sp +where file is a 4 page document this command will result in a +two page document printing two pages of \fIfile\fP per page and +rearranges the page order to match the input pages 4 and 1 +on the first output page and +pages 2 then 3 of the input document +on the second output page. diff --git a/psnup.1 b/psnup.1 deleted file mode 100644 index 14c8c6a..0000000 --- a/psnup.1 +++ /dev/null @@ -1,123 +0,0 @@ -.TH PSNUP 1 "PSUtils" -.SH NAME -psnup \- multiple pages per sheet -.SH SYNOPSIS -.B psnup -.RB [ \-p\fIpaper\-size\fR ] -.RB [ \-P\fIpaper\-size\fR ] -.RB [ \-l | \-r | \-f ] -.RB [ \-c ] -.RB [ \-m\fImargin\fR ] -.RB [ \-b\fIborder\fR ] -.RB [ \-d [ \fIlwidth\fR ]] -.RB [ \-\fInup\fR ] -.RB [ \-q ] -.RI [ infile -.RI [ outfile ]] -.SH DESCRIPTION -.B Psnup -imposes multiple logical pages on to each physical sheet of paper. -The input PostScript file should follow the Adobe Document Structuring -Conventions. -.PP -Paper sizes can be given either as a name (see -.BR paper(1)) -or as \fBwidth\fRx\fBheight\fR (see -.BR psutils (1) -for the available units). -.PP -The -.B \-p -option can be used to set the output paper size; otherwise it defaults to -the input paper size; if that is not given, a default value is used (see -.BR paper (1)). -.PP -The -.B \-P -option can be used to set the input paper size; otherwise it defaults to the -output paper size. -.PP -The -.B \-l -option should be used for pages which are in landscape orientation (rotated 90 -degrees anticlockwise). -The -.B \-r -option should be used for pages which are in seascape orientation (rotated 90 -degrees clockwise), and the -.B \-f -option should be used for pages which have the width and height interchanged, -but are not rotated. -.PP -.B Psnup -normally uses \[oq]row-major\[cq] layout, where adjacent pages are placed in rows -across the paper. -The -.B \-c -option changes the order to \[oq]column-major\[cq], where successive pages are placed -in columns down the paper. -.PP -A margin to leave around the whole page can be specified with the -.B \-m -option. -This is useful for sheets of \[oq]thumbnail\[cq] pages, because the normal -page margins are reduced by putting multiple pages on a single sheet. -.PP -The -.B \-b -option is used to specify a border around each page on a sheet. -.PP -The -.B \-d -option draws a line around the border of each page, of the specified width. -If the \fIlwidth\fR parameter is omitted, a default line width of 1 point is -assumed. -The line width is relative to the original page dimensions, -i.e., it is scaled down with the rest of the page. -.PP -The -.BI \- nup -option selects the number of logical pages to put on each sheet of paper. -This can be any positive integer; -.B psnup -tries to optimise the layout so that the minimum amount of space is wasted. -If -.B psnup -cannot find a layout within its tolerance limit, it will abort with an error -message. -The alternative form -.BI \-n nup -can also be used, for compatibility with other n-up programs. -.PP -.B Psnup -normally prints the page numbers of the pages re-arranged; the -.B \-q -option suppresses this. -.SH EXAMPLES -The potential use of this utility is varied but one particular -use is in conjunction with -.BR psbook (1). -For example, using groff to create a PostScript document and lpr as -the -.SM UNIX -print spooler a typical command line might look like this: -.sp -groff -Tps -ms \fIfile\fP | psbook | psnup -2 | lpr -.sp -where file is a 4 page document this command will result in a -two page document printing two pages of \fIfile\fP per page and -rearranges the page order to match the input pages 4 and 1 -on the first output page and -pages 2 then 3 of the input document -on the second output page. -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1), -.BR paper (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. -.SH BUGS -.B Psnup -does not accept all DSC comments. diff --git a/psnup.in.in b/psnup.in.in index 000c941..2cf936c 100644 --- a/psnup.in.in +++ b/psnup.in.in @@ -2,7 +2,7 @@ # -*- perl -*- my $version_banner = < \&parsenup, # for compatibility with other psnup implementations ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag; diff --git a/psresize-include.man b/psresize-include.man new file mode 100644 index 0000000..37a8a67 --- /dev/null +++ b/psresize-include.man @@ -0,0 +1,17 @@ +[NAME] +psresize - change the page size of a PostScript document + +[>DESCRIPTION] +.PP +.B Psresize +uses +.B Psnup +to change the page size of a document, scaling and centering it appropriately. +See +.BR psutils (1) +for the available units. + +[EXAMPLES] +The following command converts a document from A4 size to US Letter paper: +.sp +psresize -PA4 -pletter in.ps out.ps diff --git a/psresize.1 b/psresize.1 deleted file mode 100644 index 7992ada..0000000 --- a/psresize.1 +++ /dev/null @@ -1,61 +0,0 @@ -.TH PSRESIZE 1 "PSUtils" -.SH NAME -psresize \- rescales and centers a document for new output paper size -.SH SYNOPSIS -.B psresize -.B \-w\fIwidth\fR -.BR \-h\fIheight\fR | \-p\fIpaper\fR -.B \-W\fIwidth\fR -.BR \-H\fIheight\fR | \-P\fIpaper\fR -.RB [ \-q ] -.RI [ infile -.RI [ outfile ]] -.SH DESCRIPTION -.B Psresize -rescales and centres a document on a different size of paper. -The input PostScript file should follow the Adobe Document Structuring -Conventions. -.PP -The -.B \-w -option gives the output paper width, and the -.B \-h -option gives the output paper height (see -.BR psutils (1) -for the available units). -The -.B \-p -option can be used instead, to set the paper size; otherwise a default value is used (see -.BR paper (1)). -.PP -The -.B \-W -option gives the input paper width, and the -.B \-H -option gives the input paper height. -The -.B \-P -option can be used instead, to set the paper size; otherwise a default value is used. -See -.BR paper (1). -.PP -.B Psresize -normally prints the page numbers of the pages output; the -.B \-q -option suppresses this. -.SH EXAMPLES -The following command can be used to convert a document on A4 size paper to -letter size paper: -.sp -psresize -PA4 -pletter in.ps out.ps -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1), -.BR paper (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. -.SH BUGS -.B Psresize -does not accept all DSC comments. diff --git a/psresize.in.in b/psresize.in.in index 5565fe2..91c9513 100644 --- a/psresize.in.in +++ b/psresize.in.in @@ -2,7 +2,7 @@ # -*- perl -*- my $version_banner = < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag; diff --git a/psselect-include.man b/psselect-include.man new file mode 100644 index 0000000..5c6f93c --- /dev/null +++ b/psselect-include.man @@ -0,0 +1,8 @@ +[NAME] +psselect - select pages from a PostScript file + +[>DESCRIPTION] +.B Psselect +calls +.B Pstops +to do the rearrangement. diff --git a/psselect.1 b/psselect.1 deleted file mode 100644 index 1830f7b..0000000 --- a/psselect.1 +++ /dev/null @@ -1,79 +0,0 @@ -.TH PSSELECT 1 "PSUtils" -.SH NAME -psselect \- select pages from a PostScript file -.SH SYNOPSIS -.B psselect -.RB [ \-q ] -.RB [[ \-p ] \fIpages\fR ] -.RB [ \-e | \-o ] -.RB [ \-r ] -.RI [ infile -.RI [ outfile ]] -.SH DESCRIPTION -.B Psselect -selects pages from a PostScript document, creating a new PostScript file. -The input PostScript file should follow the Adobe Document Structuring -Conventions. -.PP -The -.BI \-p pages -option specifies the pages which are to be selected. -.I Pages -is a comma separated list of page ranges, each of which may be a page number, -or a page range of the form -.IB first \- last . -If -.I first -is omitted, the first page is assumed, and if -.I last -is omitted, the last page is assumed. - -The prefix character \[oq]_\[cq] indicates that the page number is relative to the end -of the document, counting backwards. -If just this character with no page number is used, a blank page will be -inserted. - -Page numbers refer to the pages as they occur in the file, starting -at one. -The actual page number in the document may be different. -.PP -The -.B \-e -option selects all of the even pages. -The -.B \-o -option selects all of the odd pages. -Either may be used in conjunction with -.B \-p -to select the even or odd pages from a range of pages. -.PP -The -.B \-r -option causes -.B psselect -to output the selected pages in reverse order. -.PP -If any of the -.BR \-r , -.BR \-e , -or -.B \-o -options are specified, any page range must be given with the -.B \-p -option. -This is for backwards compatibility with previous versions. -.PP -.B Psselect -normally prints the page numbers of the pages rearranged; the -.B \-q -option suppresses this. -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. -.SH BUGS -.I Psselect -does not accept all DSC comments. diff --git a/psselect.in.in b/psselect.in.in index 156cc50..081fbd1 100644 --- a/psselect.in.in +++ b/psselect.in.in @@ -2,7 +2,7 @@ # -*- perl -*- my $version_banner = < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag; diff --git a/pstops-include.man b/pstops-include.man new file mode 100644 index 0000000..e4e2338 --- /dev/null +++ b/pstops-include.man @@ -0,0 +1,146 @@ +[NAME] +pstops - shuffle pages in a PostScript file + +/Rearrange pages of a PostScript document/ +The input PostScript file should follow the Adobe Document Structuring +Conventions. +.PP +.I Pstops +can be used to perform arbitrary re-arrangements of documents. For many tasks, +it is simpler to use the other utilities in the PSUtils suite: see +.BR psutils (1). + +/comma-separated list of pages/ +Each may be a page number, or a page range of the form +.IB first \- last . +If +.I first +is omitted, the first page is assumed, and if +.I last +is omitted, the last page is assumed. +The prefix character \[oq]_\[cq] indicates that the page number is relative to the end +of the document, counting backwards. +If just this character with no page number is used, a blank page will be +inserted. +Page numbers refer to the pages as they occur in the file, starting +at one. +The actual page number in the document may be different. + +/its normal order/ +.PP +Pagespecs have the following syntax: +.RS +.TP 12 +.I pagespecs += +.RI [ modulo\fB:\fP ] specs +.TP +.I specs += +.IR spec [ \fB+\fPspecs | \fB,\fPspecs ] +.TP +.I spec += +.RB [ - ] \fIpageno\fP [\fIturns\fP][ @\fIscale\fP ][ ( \fIxoff\fP , \fIyoff\fP ) ] +.TP +.I turns += +.IR turn [ turns ] +.TP +.I turn += +.BR L | R | U | H | V +.RE +.sp +.I modulo +is the number of pages in each block. +The value of +.I modulo +should be greater than 0; the default value is 1. +.PP +.I specs +are the page specifications for the pages in each block. +The value of the +.I pageno +in each +.I spec +should be between 0 (for the first page in the block) and \fImodulo\fR\-1 +(for the last page in each block) inclusive. +If there is only one page specification, +the \fIpageno\fR (0) may be omitted. +.PP +The optional dimensions +.I xoff +and +.I yoff +shift the page by the specified amount. +.I xoff +and +.I yoff +may either be lengths (see +.BR psutils (1)) +or followed by +.B "w" +or +.B "h" +to indicate a multiple of the output paper width or height. +.PP +The optional parameters +.BR L , +.BR R , +.BR U , +.BR H , +and +.B V +rotate the page left, right, or upside-down, and flip (mirror) the page +horizontally or vertically respectively. +The optional +.I scale +parameter scales the page by the fraction specified. +If the optional minus sign is specified, the page number is relative to the end of +the document, instead of the start. +.PP +Pages whose +.IR spec s +are separated by +.B + +will be merged into a single page; otherwise, +they will remain as separate pages. +.PP +The shift, rotation, and scaling are applied +to the PostScript transformation matrix +in that order, regardless of the order +in which they appear on the command line. +.PP +Paper size names are converted to dimensions using +.BR paper (1). +The output paper size, if set, is used (after scaling) to set the +clipping path for each page. + +[EXAMPLES] +To put two pages on one sheet of A4 paper, the pagespec to use is: +.sp +.ce +2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm) +.sp +To select all of the odd pages in reverse order, use: +.sp +.ce +2:-0 +.sp +To re-arrange pages for printing 2-up booklets, use +.sp +.ce +4:-3L@.7(21cm,0)+0L@.7(21cm,14.85cm) +.sp +for the front sides, and +.sp +.ce +4:1L@.7(21cm,0)+-2L@.7(21cm,14.85cm) +.sp +for the reverse sides (or join them with a comma for duplex printing). + +[>AUTHOR] +.SH BUGS +.B Pstops +does not accept all DSC comments. diff --git a/pstops.1 b/pstops.1 deleted file mode 100644 index fa65fdc..0000000 --- a/pstops.1 +++ /dev/null @@ -1,235 +0,0 @@ -.TH PSTOPS 1 "PSUtils" -.SH NAME -pstops \- shuffle pages in a PostScript file -.SH SYNOPSIS -.B pstops -.RB [ \-q ] -.RB [ \-b ] -.RB [ \-w\fIwidth\fR -.BR \-h\fIheight\fR | \-p\fIpaper\fR ] -.RB [ \-W\fIwidth\fR -.BR \-H\fIheight\fR | \-P\fIpaper\fR ] -.RB [ \-d [ \fIlwidth\fR ]] -.RB [ \-o ] -.RB [ \-e ] -.RB [ \-r ] -.RB [ \-R\fIpages\fR ] -.RB [ \-s\fIsignature\fR ] -.RI [ pagespecs ] -.RI [ infile -.RI [ outfile ]] -.SH DESCRIPTION -.I Pstops -rearranges pages from a PostScript document, creating a new PostScript file. -The input PostScript file should follow the Adobe Document Structuring -Conventions. -.I Pstops -can be used to perform arbitrary re-arrangements of -documents, including arranging for printing 2-up, 4-up, booklets, reversing, -selecting front or back sides of documents, scaling, etc. -.PP -.I pagespecs -follow the syntax: -.RS -.TP 12 -.I pagespecs -= -.RI [ modulo\fB:\fP ] specs -.TP -.I specs -= -.IR spec [ \fB+\fPspecs | \fB,\fPspecs ] -.TP -.I spec -= -.RB [ - ] \fIpageno\fP [\fIturns\fP][ @\fIscale\fP ][ ( \fIxoff\fP , \fIyoff\fP ) ] -.TP -.I turns -= -.IR turn [ turns ] -.TP -.I turn -= -.BR L | R | U | H | V -.RE -.sp -.I modulo -is the number of pages in each block. -The value of -.I modulo -should be greater than 0; the default value is 1. -.PP -.I specs -are the page specifications for the pages in each block. -The value of the -.I pageno -in each -.I spec -should be between 0 (for the first page in the block) and \fImodulo\fR\-1 -(for the last page in each block) inclusive. -If there is only one page specification, -the \fIpageno\fR (0) may be omitted. -.PP -The optional dimensions -.I xoff -and -.I yoff -shift the page by the specified amount. -.I xoff -and -.I yoff -may either be lengths (see -.BR psutils (1)) -or followed by -.B "w" -or -.B "h" -to indicate a multiple of the width or height. -.PP -The optional parameters -.BR L , -.BR R , -.BR U , -.BR H , -and -.B V -rotate the page left, right, or upside-down, and flip (mirror) the page -horizontally or vertically respectively. -The optional -.I scale -parameter scales the page by the fraction specified. -If the optional minus sign is specified, the page number is relative to the end of -the document, instead of the start. -.PP -Pages whose -.IR spec s -are separated by -.B + -will be merged into a single page; otherwise, -they will remain as separate pages. -.PP -The shift, rotation, and scaling are applied -to the PostScript transformation matrix -in that order, regardless of the order -in which they appear on the command line. -.PP -The -.B \-w -option gives the width which is used by the -.B "w" -dimension specifier, and the -.B \-h -option gives the height which is used by the -.B "h" -dimension specifier. -The -.B \-p -option can be used as an alternative, to set the paper size. -See -.BR paper (1). -The -.B \-W -option gives the width of the input paper and the -.B \-H -option gives the height of the output paper. -The -.B \-P -option can be used as an alternative, to set the input paper size. -See -.BR paper (1). -These dimensions, if given are also used (after scaling) to set the -clipping path for each page. -.PP -The -.BI \-R pages -option specifies the pages which are to be selected. -.I Pages -is a comma separated list of page ranges, each of which may be a page number, -or a page range of the form -.IB first \- last . -If -.I first -is omitted, the first page is assumed, and if -.I last -is omitted, the last page is assumed. - -The prefix character \[oq]_\[cq] indicates that the page number is relative to the end -of the document, counting backwards. -If just this character with no page number is used, a blank page will be -inserted. - -Page numbers refer to the pages as they occur in the file, starting -at one. -The actual page number in the document may be different. -.PP -The -.B \-e -option selects all of the even pages. -The -.B \-o -option selects all of the odd pages. -Either may be used in conjunction with -.B \-R -to select the even or odd pages from a range of pages. -.PP -The -.B \-r -option causes -.B psselect -to output the selected pages in reverse order. -.PP -The -.B \-b -option prevents any -.B bind -operators in the PostScript prolog from binding. -This may be needed for complex multi-page re-arrangements. -.PP -The -.B \-d -option draws a line around the border of each page, of the specified width. -If the \fIlwidth\fR parameter is omitted, it defaults to \fB1pt\fR. -The width is relative to the original page dimensions, -i.e., it is scaled with the rest of the page. -.PP -The -.B \-s -option gives the number of pages in each signature, which must be either 1 -(the default), a multiple of 4, or, to put all pages in a single signature, 0. -.PP -Pstops normally prints the page numbers of the pages re-arranged; the -.B \-q -option suppresses this. -.SH EXAMPLES -To put two pages on one sheet of A4 paper, the pagespec to use is: -.sp -.ce -"2:0L@.7(21cm,0)+1L@.7(21cm,14.85cm)" -.sp -To select all of the odd pages in reverse order, use: -.sp -.ce -2:-0 -.sp -To re-arrange pages for printing 2-up booklets, use -.sp -.ce -"4:-3L@.7(21cm,0)+0L@.7(21cm,14.85cm)" -.sp -for the front sides, and -.sp -.ce -"4:1L@.7(21cm,0)+-2L@.7(21cm,14.85cm)" -.sp -for the reverse sides (or join them with a comma for duplex printing). -.SH AUTHOR -Written by Angus J. C. Duggan. -.SH "SEE ALSO" -.BR psutils (1), -.BR paper (1) -.SH TRADEMARKS -.B PostScript -is a trademark of Adobe Systems Incorporated. -.SH BUGS -.B Pstops -does not accept all DSC comments. diff --git a/pstops.in.in b/pstops.in.in index e945d7d..7439ec4 100644 --- a/pstops.in.in +++ b/pstops.in.in @@ -2,7 +2,7 @@ # -*- perl -*- my $version_banner = < \$version_flag, ) or usage(1); if ($version_flag) { - print STDERR $version_banner; + print STDOUT $version_banner; exit 0; } usage(0) if $help_flag;