Coder Social home page Coder Social logo

psutils's Introduction

PDF and PostScript Utilities

Web site: https://github.com/rrthomas/psutils
Maintainer: Reuben Thomas [email protected]

PSUtils is a suite of utilities for manipulating PDF and PostScript documents. You can select and rearrange pages, including arrangement into signatures for booklet printing, combine multple pages into a single page for n-up printing, and resize, flip and rotate pages.

PSUtils is distributed under the GNU General Public License version 3, or, at your option, any later version; see the file COPYING. (Some of the input files in the tests directory are not under this license; see the file COPYRIGHT in that directory.)

If you simply want to use PSUtils, you will find it in most GNU/Linux distributions; it is available in brew for macOS and Cygwin for Windows.

PostScript files should conform to the PostScript Document Structuring Conventions (DSC); however, PSUtils intentionally does not check this, as some programs produce non-conforming output that can be successfully processed anyway. If PSUtils does not work for you, check whether your software needs to be configured to produce DSC-conformant PostScript.

Some old Perl scripts, which mostly fix up the output of various obsolete programs and drivers to enable PSUtils to process it, are available in git in the old-scripts directory. They are not supported, and their use is discouraged, unless you know you need them!

Installation

The easiest way to install PSUtils is from PyPI, the Python Package Index:

pip install pspdfutils

(Note the PyPI package name!)

Installation from source or git

PSUtils requires Python 3.9 or later, a handful of Python libraries (listed in pyproject.toml, and automatically installed by the build procedure), and libpaper, which allows named paper sizes to be used and configured:

libpaper: https://github.com/rrthomas/libpaper

In the source directory: python -m build (requires the build package to be installed).

Note that to use the scripts before installing them, you need to run them as Python modules; for example:

PYTHONPATH=. python -m psutils.command.psnup -2 foo.ps

Bugs

Please send bug reports, patches and suggestions to the bug tracker or maintainer (see the top of this file).

Acknowledgements

PSUtils is written and maintained by Reuben Thomas. Version 1 was written by Angus Duggan.

psselect in modeled on Chris Torek's dviselect, as is psbook, via Angus Duggan's dvibook; pstops is modeled on Tom Rokicki's dvidvi. psjoin was originally written by Tom Sato.

psutils's People

Contributors

cclauss avatar eric-s-raymond avatar jpopelka avatar kloczek avatar rrthomas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

psutils's Issues

Does not support Python 3.8

I'm packaging your module as an rpm package so I'm using the typical PEP517 based build, install and test cycle used on building packages from non-root account.

  • python3 -sBm build -w --no-isolation
  • because I'm calling build with --no-isolation I'm using during all processes only locally installed modules
  • install .whl file in </install/prefix> using 'installer` module
  • run pytest with $PYTHONPATH pointing to sitearch and sitelib inside </install/prefix>
  • build is performed in env which is cut off from access to the public network (pytest is executed with -m "not network")

Here is pytest output:

+ PYTHONPATH=/home/tkloczko/rpmbuild/BUILDROOT/psutils-3.0.6-2.fc35.x86_64/usr/lib64/python3.8/site-packages:/home/tkloczko/rpmbuild/BUILDROOT/psutils-3.0.6-2.fc35.x86_64/usr/lib/python3.8/site-packages
+ /usr/bin/pytest -ra -m 'not network'
============================= test session starts ==============================
platform linux -- Python 3.8.17, pytest-7.4.0, pluggy-1.0.0
rootdir: /home/tkloczko/rpmbuild/BUILD/psutils-3.0.6
collected 0 items / 9 errors

==================================== ERRORS ====================================
____________________ ERROR collecting tests/test_epsffit.py ____________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_epsffit.py:7: in <module>
    from testutils import file_test, make_tests, Case
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
__________________ ERROR collecting tests/test_extractres.py ___________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_extractres.py:5: in <module>
    from testutils import file_test, compare_text_files, Case, GeneratedInput
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
__________________ ERROR collecting tests/test_includeres.py ___________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_includeres.py:6: in <module>
    from testutils import file_test, make_tests, Case
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
____________________ ERROR collecting tests/test_psbook.py _____________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_psbook.py:3: in <module>
    from testutils import file_test, make_tests, Case, GeneratedInput
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
____________________ ERROR collecting tests/test_psjoin.py _____________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_psjoin.py:5: in <module>
    from testutils import make_tests, file_test, Case, GeneratedInput
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
_____________________ ERROR collecting tests/test_psnup.py _____________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_psnup.py:4: in <module>
    from testutils import file_test, make_tests, Case, GeneratedInput
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
___________________ ERROR collecting tests/test_psresize.py ____________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_psresize.py:3: in <module>
    from testutils import file_test, make_tests, Case, GeneratedInput
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
___________________ ERROR collecting tests/test_psselect.py ____________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_psselect.py:3: in <module>
    from testutils import file_test, make_tests, Case, GeneratedInput
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
____________________ ERROR collecting tests/test_pstops.py _____________________
/usr/lib/python3.8/site-packages/_pytest/runner.py:341: in from_call
    result: Optional[TResult] = func()
/usr/lib/python3.8/site-packages/_pytest/runner.py:372: in <lambda>
    call = CallInfo.from_call(lambda: list(collector.collect()), "collect")
/usr/lib/python3.8/site-packages/_pytest/python.py:536: in collect
    self._inject_setup_module_fixture()
/usr/lib/python3.8/site-packages/_pytest/python.py:550: in _inject_setup_module_fixture
    self.obj, ("setUpModule", "setup_module")
/usr/lib/python3.8/site-packages/_pytest/python.py:315: in obj
    self._obj = obj = self._getobj()
/usr/lib/python3.8/site-packages/_pytest/python.py:533: in _getobj
    return self._importtestmodule()
/usr/lib/python3.8/site-packages/_pytest/python.py:622: in _importtestmodule
    mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
/usr/lib/python3.8/site-packages/_pytest/pathlib.py:565: in import_path
    importlib.import_module(module_name)
/usr/lib64/python3.8/importlib/__init__.py:127: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
<frozen importlib._bootstrap>:1014: in _gcd_import
    ???
<frozen importlib._bootstrap>:991: in _find_and_load
    ???
<frozen importlib._bootstrap>:975: in _find_and_load_unlocked
    ???
<frozen importlib._bootstrap>:671: in _load_unlocked
    ???
/usr/lib/python3.8/site-packages/_pytest/assertion/rewrite.py:178: in exec_module
    exec(co, module.__dict__)
tests/test_pstops.py:5: in <module>
    from testutils import file_test, make_tests, Case, GeneratedInput
tests/testutils.py:22: in <module>
    def chdir(path: os.PathLike[str]) -> Iterator[None]:
E   TypeError: 'ABCMeta' object is not subscriptable
=========================== short test summary info ============================
ERROR tests/test_epsffit.py - TypeError: 'ABCMeta' object is not subscriptable
ERROR tests/test_extractres.py - TypeError: 'ABCMeta' object is not subscript...
ERROR tests/test_includeres.py - TypeError: 'ABCMeta' object is not subscript...
ERROR tests/test_psbook.py - TypeError: 'ABCMeta' object is not subscriptable
ERROR tests/test_psjoin.py - TypeError: 'ABCMeta' object is not subscriptable
ERROR tests/test_psnup.py - TypeError: 'ABCMeta' object is not subscriptable
ERROR tests/test_psresize.py - TypeError: 'ABCMeta' object is not subscriptable
ERROR tests/test_psselect.py - TypeError: 'ABCMeta' object is not subscriptable
ERROR tests/test_pstops.py - TypeError: 'ABCMeta' object is not subscriptable
!!!!!!!!!!!!!!!!!!! Interrupted: 9 errors during collection !!!!!!!!!!!!!!!!!!!!
============================== 9 errors in 1.38s ===============================

Here is list of installed modules in build env

Package                       Version
----------------------------- -------
alabaster                     0.7.13
argparse-manpage              4.3
asttokens                     2.2.1
Babel                         2.12.1
backcall                      0.2.0
build                         0.10.0
charset-normalizer            3.1.0
decorator                     5.1.1
distro                        1.8.0
docutils                      0.19
exceptiongroup                1.1.1
executing                     1.2.0
gpg                           1.20.0
idna                          3.4
imagesize                     1.4.1
importlib-metadata            6.7.0
iniconfig                     2.0.0
installer                     0.7.0
ipython                       8.12.0
jedi                          0.18.2
Jinja2                        3.1.2
libcomps                      0.1.19
MarkupSafe                    2.1.2
matplotlib-inline             0.1.6
maturin                       1.1.0
packaging                     23.1
parso                         0.8.3
pexpect                       4.8.0
pickleshare                   0.7.5
pluggy                        1.0.0
prompt-toolkit                3.0.38
ptyprocess                    0.7.0
pure-eval                     0.2.2
puremagic                     1.15
Pygments                      2.15.1
pyproject_hooks               1.0.0
pytest                        7.4.0
pytest-datafiles              3.0.0
python-dateutil               2.8.2
pytz                          2023.2
requests                      2.31.0
setuptools                    68.0.0
six                           1.16.0
snowballstemmer               2.2.0
Sphinx                        6.2.1
sphinxcontrib-applehelp       1.0.4
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        2.0.0
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.5
stack-data                    0.6.2
tomli                         2.0.1
traitlets                     5.9.0
typing_extensions             4.7.1
urllib3                       1.26.15
wcwidth                       0.2.6
wheel                         0.40.0
zipp                          3.15.0

pstops: shifting relative to page dimensions fails without a --paper option

I got a report that ptops of psutils-2.05 fails:

$ perl -I. ./pstops '[email protected](1w,0)[email protected](1w,.5h)' </tmp/input.ps >/tmp/bad.ps
pstops: paper size not set

while it used to work with psutils-1.23 where it used a default paper size if not specified with the option.

I can see that pstops(1) manual permits a case without a known output paper size when dealing with the final bounding box:

   Paper  size names are converted to dimensions using paper(1).  The output paper size,
   if set, is used (after scaling) to set the clipping path for each page.

When fixing the page shift, would you accept a change that would change this behavior (i.e. use a default page size even for the clipping), or would you rather preserve it? I think it's more useful to default in all cases to the default paper size.

Also please notice this mishandling of an empty string:

$ perl -I. ./pstops --paper '' '[email protected](1w,0)[email protected](1w,.5h)' </tmp/input.ps >/tmp/bad.ps
Use of uninitialized value in subroutine entry at PSUtils.pm line 39.
Use of uninitialized value in subtraction (-) at PSUtils.pm line 40.
Use of uninitialized value $str in substr at PSUtils.pm line 40.
Use of uninitialized value in subroutine entry at PSUtils.pm line 39.
Use of uninitialized value in subtraction (-) at PSUtils.pm line 40.
Use of uninitialized value $str in substr at PSUtils.pm line 40.
[1] [2] Wrote 2 pages

1.90: test suite is failing

[tkloczko@domek psutils-1.90]$ make check
make  check-TESTS
make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/psutils-1.90'
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/psutils-1.90'
FAIL: tests/psbook-20.sh
FAIL: tests/psbook-20-signature-4.sh
FAIL: tests/psbook-3.sh
FAIL: tests/psbook-3-signature-4.sh
XFAIL: tests/psbook-invalid-signature-size.sh
PASS: tests/psjoin-1-2.sh
PASS: tests/psjoin-1-2-even.sh
PASS: tests/psjoin-1-2-save.sh
PASS: tests/psjoin-1-2-nostrip.sh
FAIL: tests/psnup-20-1.sh
FAIL: tests/psnup-20-2.sh
FAIL: tests/psnup-20-3.sh
FAIL: tests/psnup-20-4.sh
FAIL: tests/psnup-20-1-inpaper-A5.sh
FAIL: tests/psnup-20-1-inpaper-A5-outpaper-A5.sh
FAIL: tests/psnup-20-1-inpaper-A4-outpaper-A5.sh
FAIL: tests/psnup-20-2-inpaper-A5.sh
FAIL: tests/psnup-20-3-inpaper-A5.sh
FAIL: tests/psnup-20-4-inpaper-A5.sh
FAIL: tests/psnup-20-3-rotatedleft.sh
FAIL: tests/psnup-20-3-rotatedright.sh
FAIL: tests/psnup-20-1-flip.sh
FAIL: tests/psnup-20-4-flip.sh
FAIL: tests/psnup-20-4-297mmx210mm.sh
FAIL: tests/psnup-20-4-columnmajor.sh
FAIL: tests/psnup-20-4-margin-10.sh
FAIL: tests/psnup-20-4-border-20.sh
XFAIL: tests/psnup-20-3-impossible-tolerance.sh
XFAIL: tests/psnup-20-4-impossible-margin.sh
XFAIL: tests/psnup-20-4-impossible-border.sh
FAIL: tests/psresize-20-A5.sh
FAIL: tests/psresize-20-A3.sh
FAIL: tests/psresize-20-A4.sh
FAIL: tests/psresize-20-Letter.sh
FAIL: tests/psresize-20-A5in-A4.sh
FAIL: tests/psresize-20-A3in-A4.sh
FAIL: tests/psselect-odd.sh
FAIL: tests/psselect-even.sh
FAIL: tests/psselect-reverse.sh
FAIL: tests/psselect-even-reverse.sh
PASS: tests/psselect-positive-range.sh
FAIL: tests/psselect-negative-range.sh
FAIL: tests/psselect-positive-negative-range.sh
PASS: tests/psselect-individual-pages-and-dash-p.sh
FAIL: tests/psselect-options-and-complex-pagerange.sh
XFAIL: tests/psselect-invalid-pagerange.sh
PASS: tests/epsffit.sh
PASS: tests/epsffit-center.sh
PASS: tests/epsffit-rotate.sh
PASS: tests/epsffit-aspect.sh
PASS: tests/epsffit-maximize.sh
PASS: tests/epsffit-center-rotate.sh
PASS: tests/epsffit-rotate-aspect.sh
PASS: tests/epsffit-rotate-maximize.sh
PASS: tests/epsffit-center-rotate-aspect.sh
PASS: tests/epsffit-center-rotate-maximize.sh
PASS: tests/epsffit-center-rotate-aspect-maximize.sh
PASS: tests/epsffit-showpage.sh
PASS: tests/extractres-and-includeres.sh
============================================================================
Testsuite summary for psutils 1.90
============================================================================
# TOTAL: 59
# PASS:  19
# SKIP:  0
# XFAIL: 5
# FAIL:  35
# XPASS: 0
# ERROR: 0
============================================================================
See ./test-suite.log
Please report to [email protected]
============================================================================

missing test dependencies?

I've tried packaging psutils 3 for pkgsrc and installed the packages listed in pyproject.toml. After installing psutils and running pytest, I see lots of errors like this:

______________________________________________________________ ERROR at setup of test_psbook[3] ______________________________________________________________
file /scratch/wip/psutils/work/psutils-3.0/tests/testutils.py, line 108
  def file_test(
E       fixture 'file_type' not found
>       available fixtures: cache, capfd, capfdbinary, caplog, capsys, capsysbinary, datafiles, doctest_namespace, monkeypatch, pytestconfig, record_property,
 record_testsuite_property, record_xml_attribute, recwarn, tmp_path, tmp_path_factory, tmpdir, tmpdir_factory
>       use 'pytest --fixtures [testpath]' for help on them.
/scratch/wip/psutils/work/psutils-3.0/tests/testutils.py:108

I also have many with

E       fixture 'regenerate_input' not found

Which pypi modules provide these fixtures? Could you please add them as pyproject.toml dependencies?

I also see warnings about a couple missing files:

E       FileNotFoundError: [Errno 2] No such file or directory: '/scratch/wip/psutils/work/psutils-3.0/tests/test-files/extractres/sample/ISO-8859-1Encoding-expected.enc'
E       FileNotFoundError: [Errno 2] No such file or directory: '/scratch/wip/psutils/work/psutils-3.0/tests/test-files/includeres/sample/ISO-8859-1Encoding.enc'                                                            

(there is no tests/test-files directory in the tarball).

2.0 release

Flagging that there's no packaged release download for 2.0

Blank pages inserted by psbook are not rendered

The psbook utility may insert blank pages to fill out signatures to a multiple of 4 pages. The blank pages get inserted as stand-alone underscores in a page-range list when invoking the next process, psselect, e.g.,

psselect -R _,1,2,_

The blank pages are not actually rendered in the output when the next process, pstops, is exec'd.

I'm not sure if this is the correct fix, but it looks like the &$page_to_real_page($real_page) value for the blank pages returns a value of -1. If this really reflects a "missing page" value, then perhaps the value should be checked to be non-negative first. A potential fix in the pstops() function may be to replace

if ($real_page < $pages_to_output && &$page_to_real_page($real_page) < $psinfo->{pages}) {
  # Write the body of a page
  fcopy(${$psinfo->{pageptr}}[&$page_to_real_page($real_page) + 1]);
} 

with code like the following:

if ($real_page < $pages_to_output && &$page_to_real_page($real_page) >= 0 &&
      &$page_to_real_page($real_page) < $psinfo->{pages}) {
        # Write the body of a page
        fcopy(${$psinfo->{pageptr}}[&$page_to_real_page($real_page) + 1]);
}

pstops pagespec parsing bugs

It seems that pstops shift is not working. A command like

pstop '1:0(100pt,100pt)' file1.ps > file2.ps

produces a ps that is visually the same with no content shifted.

I have reproduced the problem with the pstops of my distro (Manjaro, psutils 1.90-1), and with the code in the master branch.

Nevertheless, 1.23 works properly.

psnup does not respect output paper size

Converting a postscript file using psnup always outputs in letter size.
To reproduce take a four A4 page postscript file and convert it to booklet page order

psbook printfile.ps psbook.ps

Convert the pages to two up

psnup -p A4 -2 psbook.ps fpbooklet.ps

The result is a booklet file on Letter format.

Please make new release

Hi,

Seems last release has been done few years ago and in meantime many new changes have been committed. I think that it would be good to make new release :)

Failing tests 2.08 release

Hi,

I wanted to update psutils to the newest release in Fedora, but I've run into multiple test failures when trying to build it.
Compared to 2.07 release, where there was 6 XFAIL tests, the 2.08 release has added 25 FAIL test on top.

Could you please look into this issue?

make  check-TESTS
make[1]: Entering directory '/builddir/build/BUILD/psutils-2.08'
make[2]: Entering directory '/builddir/build/BUILD/psutils-2.08'
PASS: tests/pstops-offsets.sh
PASS: tests/pstops-negative-offsets.sh
PASS: tests/pstops-multiple-pages.sh
XFAIL: tests/pstops-invalid-pagespecs.sh
FAIL: tests/pstops-multiple-turns-and-flips.sh
FAIL: tests/pstops-correct-angles.sh
PASS: tests/psbook-20.sh
PASS: tests/psbook-3.sh
PASS: tests/psbook-20-signature-4.sh
PASS: tests/psbook-3-signature-4.sh
XFAIL: tests/psbook-invalid-signature-size.sh
PASS: tests/psjoin-1-2-even.sh
PASS: tests/psjoin-1-2.sh
PASS: tests/psjoin-1-2-nostrip.sh
PASS: tests/psjoin-1-2-save.sh
FAIL: tests/psnup-20-2.sh
FAIL: tests/psnup-20-1.sh
FAIL: tests/psnup-20-4.sh
FAIL: tests/psnup-20-3.sh
FAIL: tests/psnup-20-1-inpaper-A5.sh
FAIL: tests/psnup-20-1-inpaper-A5-outpaper-A5.sh
FAIL: tests/psnup-20-1-inpaper-A4-outpaper-A5.sh
FAIL: tests/psnup-20-3-inpaper-A5.sh
FAIL: tests/psnup-20-2-inpaper-A5.sh
FAIL: tests/psnup-20-3-rotatedleft.sh
FAIL: tests/psnup-20-4-inpaper-A5.sh
FAIL: tests/psnup-20-1-flip.sh
FAIL: tests/psnup-20-3-rotatedright.sh
FAIL: tests/psnup-20-4-flip.sh
FAIL: tests/psnup-20-4-columnmajor.sh
PASS: tests/psnup-20-4-297mmx210mm.sh
FAIL: tests/psnup-20-4-border-20.sh
FAIL: tests/psnup-20-4-margin-10.sh
XFAIL: tests/psnup-20-4-impossible-margin.sh
XFAIL: tests/psnup-20-3-impossible-tolerance.sh
XFAIL: tests/psnup-20-4-impossible-border.sh
FAIL: tests/psresize-20-A5.sh
FAIL: tests/psresize-20-A3.sh
FAIL: tests/psresize-20-A4.sh
FAIL: tests/psresize-20-Letter.sh
FAIL: tests/psresize-20-A5in-A4.sh
FAIL: tests/psresize-20-A3in-A4.sh
PASS: tests/psselect-odd.sh
PASS: tests/psselect-reverse.sh
PASS: tests/psselect-even.sh
PASS: tests/psselect-positive-range.sh
PASS: tests/psselect-even-reverse.sh
PASS: tests/psselect-negative-range.sh
PASS: tests/psselect-positive-negative-range.sh
PASS: tests/psselect-individual-pages-and-dash-p.sh
XFAIL: tests/psselect-invalid-pagerange.sh
PASS: tests/psselect-options-and-complex-pagerange.sh
PASS: tests/epsffit.sh
PASS: tests/epsffit-rotate.sh
PASS: tests/epsffit-center.sh
PASS: tests/epsffit-aspect.sh
PASS: tests/epsffit-maximize.sh
PASS: tests/epsffit-rotate-aspect.sh
PASS: tests/epsffit-rotate-maximize.sh
PASS: tests/epsffit-center-rotate.sh
PASS: tests/epsffit-center-rotate-maximize.sh
PASS: tests/epsffit-center-rotate-aspect.sh
PASS: tests/epsffit-center-rotate-aspect-maximize.sh
PASS: tests/epsffit-showpage.sh
PASS: tests/extractres-and-includeres.sh
============================================================================
Testsuite summary for psutils 2.08
============================================================================
# TOTAL: 65
# PASS:  34
# SKIP:  0
# XFAIL: 6
# FAIL:  25
# XPASS: 0
# ERROR: 0

psbook Stream vs file discrepancy

This is tested on 1.93

With files everything is great:

~/test-print $ psjoin {01..16}.ps >combined-1.ps
~/test-print $ psbook -s16 <combined-1.ps >combined-2.ps
[1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13] [14] [15] [16] Wrote 16 pages

With streams, not so much:

~/test-print $ psjoin {01..16}.ps | psbook -s16 >combined-2.ps
pstops: page range 16 is invalid

Let me know if you need anything more to reproduce

Infinite recursion with some PDF inputs

Apologies if this is the wrong place to report this.

I have just found your project to replace pdfbook and pdfnup as I'm moving away from LaTeX to Typst.
I was delighted to find it was available via brew, and appeared to install v3.0.9 without issue on my macOS 13.4.1 machine.
However, man pdfbook etc. return "No manual entry for pdfbook". As the README here doesn't include any usage, I was reduced to reading the code to find the args. I'm not sure why this is missing.

psbook works as expected.
But psnup -2 <file> produces lots of errors:

Traceback (most recent call last):
  File "/usr/local/bin/psbook", line 8, in <module>
    sys.exit(psbook())
             ^^^^^^^^
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/psutils/command/psbook.py", line 86, in psbook
    transform.transform_pages(
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/psutils/transformers.py", line 132, in transform_pages
    transform_pages(pagerange, odd, even, reverse)
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/psutils/transformers.py", line 127, in transform_pages
    self.finalize()
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/psutils/transformers.py", line 482, in finalize
    self.writer.write(self.outfile)
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/pypdf/_writer.py", line 1310, in write
    self.write_stream(stream)
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/pypdf/_writer.py", line 1283, in write_stream
    object_positions = self._write_pdf_structure(stream)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/pypdf/_writer.py", line 1325, in _write_pdf_structure
    object_positions.append(stream.tell())
                            ^^^^^^^^^^^^^
OSError: [Errno 29] Illegal seek
EOF marker not found
Traceback (most recent call last):
  File "/usr/local/bin/psnup", line 8, in <module>
    sys.exit(psnup())
             ^^^^^^^
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/psutils/command/psnup.py", line 158, in psnup
    doc = document_reader(infile, file_type)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/psutils/readers.py", line 124, in document_reader
    return constructor(file)
           ^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/psutils/readers.py", line 25, in __init__
    super().__init__(stream, strict, password)
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/pypdf/_reader.py", line 318, in __init__
    self.read(stream)
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/pypdf/_reader.py", line 1537, in read
    self._find_eof_marker(stream)
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/pypdf/_reader.py", line 1608, in _find_eof_marker
    line = read_previous_line(stream)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/Cellar/psutils/3.0.9/libexec/lib/python3.11/site-packages/pypdf/_utils.py", line 266, in read_previous_line
    raise PdfStreamError(STREAM_TRUNCATED_PREMATURELY)
pypdf.errors.PdfStreamError: Stream has ended unexpectedly

I'm nopsbook and psnup are both in /usr/local/bin/ and are in the PATH.

psnup fails due to paper command output (with hotfix)

First reported here: https://bugzilla.opensuse.org/show_bug.cgi?id=1202402

System:
OpenSuse Tumbleweed

Packages:
psutils-2.08-1.3.x86_64
paper-2.3-2.3.x86_64

When running psnup, /usr/share/psutils/PSUtils.pm will run paper --unit=pt $paper_name (Line 76)

It will expect a return value of / ([.0-9]+)x([.0-9]+) pt$/ (Line 77)

This (OpenSuse's) version of paper will output e.g. "A4" unless called with --size; then it will output "595.275590551181 841.889763779527" (which still can't be parsed)

Fixed function (sorry for not providing a patch):

/usr/share/psutils/PSUtils.pm

sub paper_size {
  my ($paper_name) = @_;
  chomp($paper_name = paper([])) unless defined($paper_name);
  my $dimensions = paper(["--unit=pt", "$paper_name"], 1) or return;
  my @match = $dimensions =~ / ([.0-9]+)x([.0-9]+) pt$/;
  if (!@match) {
    $dimensions = paper(["--unit=pt", "--size", "$paper_name"], 1);
    @match = $dimensions =~ /([.0-9]+) ([.0-9]+)$/;
  }
  my $old_locale = setlocale(LC_ALL);
  setlocale(LC_ALL, "");
  my ($w, $w_unparsed) = strtod($match[0]);
  my ($h, $h_unparsed) = strtod($match[1]);
  setlocale(LC_ALL, $old_locale);
  return int($w + 0.5), int($h + 0.5); # round dimensions to nearest point
}

Data are lost between execs when using pipes

I commented on Issue #25 which had been closed, but it didn't look like I could re-open it. Like Issue #25, I also had trouble using the psutils in a filter chain, using the most recent version from GitHub here. To create a folded booklet from double-sided 2-up pages, my chain looks like:

dvips -f book | psbook | psnup -2 > out.ps`

I think I tracked down the problem to the seekable() function in PSUtils.pm. After STDIN has been copied to the temporary file, the $fp handle is closed, closing STDIN, and the tempfile's file handle is returned in its place.

The problem is that in the calling function setup_input_and_output(), we have $infile = seekable($infile). This replaces the reference to STDIN with the new filehandle, but the file descriptor associated with STDIN has already been closed. Since the next process psselect is exec'd and STDIN has been closed, the next process has no open STDIN descriptor.

One way to fix this may be to reopen STDIN using the new file descriptor, rather than simply closing it. E.g., in seekable(), replace

close $fp;
return $ft if seek $ft, 0, SEEK_SET;

with something like

open($fp, "<&=", fileno($ft));
return $fp if seek $fp, 0, SEEK_SET;

This replaces STDIN itself with the open file descriptor pointing to the tempfile, and this value is preserved across the exec.

Configure-time support for libpaper

Would you be up to add a configure-time option to use 'libpaper''s 'paperconf' in place of 'paper'? I don't see a huge difference between the two, and while 'libpaper' is packaged on my distro (arch), I'd have to add a new package for 'paper'.

I can (and probably will) do that but I just know a program called 'paper' is someday going to conflict with other packages, and I've never seen it used elsewhere.
Edit: I did add a package to arch linux but I still think this is a good idea

psutils is broken if LANG is set de_DE.UTF8

I got lots of error like the following with the test-suite if I set LANG:

$:> export LANG=de_DE.UTF8
$:> psnup
bad dimension at /usr/lib/perl5/site_perl/5.28/PSUtils.pm line 34.

self-locating PSUtils.cpm

unless i'm missing something, in psutils 1.90, the scripts can't be used in TeX Live as is, since they "use PSutils" but do nothing to add a relative directory to the search path. Since TL can be installed anywhere, it would be necessary to do something like unshift(@inc, $psutilsdir)
where $psutilsdir is given by $FindBin::RealBin. wdyt?

In addition, it is unclear to me whether we can reasonably install your new paper program in TL, unless distros have generally adopted it. Making this scheme interoperate with TL's paper selection does not look simple. So maybe it is not worth doing anything, and we simply will not ever upgrade psutils, or leave it to the distros ... --best, karl.

Improve error messages

Return different error code for syntax error and errors while running, and don't print usage message in the latter case.

Prefix errors with program name.

psbook: Explanation of “signature” and printing unclear

I try to understand how the “signature” is meant to be used and how to print the book afterwards.
May I ask you to explain. Many thanks.

With -s 4 first eight pages are ordered 4-1-2-3-8-5-6-7.
When printing this 4 pages on a sheet side (psnup -4), this gives:

 Front:  4 1   Back:  8 5
         2 3          6 7

Now when binding and folding, then turning around from page 1 one will get to page 8.
Even if pages 2, 3, 6, 7 are rotated 180°and folding differently, from page 1 one will get to page 3.

When using psnup -2 it's basically the same.

psmerge fails with the following two documents

Hi...

please help understanding why psmerge gets error over the attached examples...

Error: /stackoverflow in /--%setdevicecolor_cont--
Operand stack:
--nostringval--
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1992 2 3 %oparray_pop 1991 2 3 %oparray_pop 1979 2 3 %oparray_pop 1833 2 3 %oparray_pop --nostringval-- %errorexec_pop .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- 1 0
Dictionary stack:
--dict:732/1123(ro)(G)-- --dict:0/20(G)-- --dict:81/200(L)-- --dict:86/300(L)--
Current allocation mode is local
Current file position is 24997
GPL Ghostscript 9.27: Unrecoverable error, exit code 1

I renamed them with .txt extension but they're .ps files...

thank you

rodolfo
test2.txt
test3.txt

pstops does not recognise left from right

Hi, I've got an report saying, that pstops doesn't recognise left from right.

These two commands :

$ pstops -pa4 -S '0L(1w,0)+0L(1w,.5h)' <file.ps

$ pstops -pa4 -S '0L(1w,0)+0R(1w,.5h)' <file.ps

produce the same output, yet the top half should be rotated to the left in the first case, to the right in the second. Also, in the second case, the offset (1w,.5h) should be (0,1h) to keep the result on the same page.

tag mismatch

👋 looks like pypi has 3.0.2 and 3.0.3, while they are missed in the github repo.

image

Make PyPI release

👋 I saw the build setup got changed drastically, but could not find the artifact on pypi, can I get some pointer? Thanks!

`psnup` automatically adds a bottom margin?

Trying to print a book, and no matter what settings I use I can't get rid of an half-inch-ish margin on the bottom of my pdf. It gets added during the psnup stage and messes up the formatting for the entire booklet, pushing the first few lines off the top of the page.

If there's any way to get around that, I'd appreciate it.

pdf2ps Dark\ Wizard\ of\ Donkirk.pdf - | psbook -s32 | psnup -2 -pletter -s1 -b0 -m0 | ps2pdf - booklet.pdf

Dark Wizard of Donkirk.pdf

Issues in psutils man pages

`Dear psutils maintainer,
the manpage-l10n project maintains a large number of translations of
man pages both from a large variety of sources (including psutils) as
well for a large variety of target languages.

During their work translators notice different possible issues in the
original (english) man pages. Sometimes this is a straightforward
typo, sometimes a hard to read sentence, sometimes this is a
convention not held up and sometimes we simply do not understand the
original.

We use several distributions as sources and update regularly (at
least every 2 month). This means we are fairly recent (some
distributions like archlinux also update frequently) but might miss
the latest upstream version once in a while, so the error might be
already fixed. We apologize and ask you to close the issue immediately
if this should be the case, but given the huge volume of projects and
the very limited number of volunteers we are not able to double check
each and every issue.

Secondly we translators see the manpages in the neutral po format,
i.e. converted and harmonized, but not the original source (be it man,
groff, xml or other). So we cannot provide a true patch (where
possible), but only an approximation which you need to convert into
your source format.

Finally the issues I'm reporting have accumulated over time and are
not always discovered by me, so sometimes my description of the
problem my be a bit limited - do not hesitate to ask so we can clarify
them.

I'm now reporting the errors for your project. If future reports
should use another channel, please let me know.

Man page: psbook.1
Issue: Usually bold commands use a lower case, even at the beginning of a sentence
"B uses B 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."

Issue: I<-s> → B<-s>

"The I<-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 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."

Issue: I<-q> → B<-q>

"Psbook normally prints the page numbers of the pages rearranged; the I<-q> "
"option suppresses this."

Issue 1: Missing B<> around names, e.g. pstops(1) → B(1)
Issue 2: Remove psbook(1), see also to itself does not make sense

"psbook(1), psselect(1), pstops(1), epsffit(1), psnup(1), psresize(1), "
"psmerge(1), fixscribeps(1), getafm(1), fixdlsrps(1), fixfmps(1), "
"fixpsditps(1), fixpspps(1), fixtpps(1), fixwfwps(1), fixwpps(1), fixwwps(1), "
"extractres(1), includeres(1), showchar(1)"
`

man page overhaul

Write man pages using help2man to common up option docs.

Once we have the final interface, refactor the man pages to avoid duplication.

psmerge question

Sorry to ask a question in the bug report section.

Why is 'psmerge' marked as obsolete and no longer included? Could be useful to add a comment to the top of the file.

Edit: Is this because psjoin is redundant? I didn't notice that alternative

psnup -p a4 → Use of uninitialized value in subroutine entry at /usr/share/psutils/PSUtils.pm line 80/81

Situation on Arch with libpaper 2.0.10-1 and psutils 2.09-1 installed:

$ locale
LC_PAPER="de_DE.UTF-8"
… all others set to "de_DE.UTF-8", except for …
LC_ALL=

$ ls -d ~/.config/pa*
.config/pavucontrol-qt

$ cat /etc/papersize 
A4

$ paper
A4: 210x297 mm

I would expect psnup NOT to give this error:

$ psnup
psnup: output paper size not set, and could not get default paper size

Using test.pdf I get PSUtils.pm errors and a 0 byte output file nup.ps no matter which psnup arguments I give:

$ pdftops test.pdf test.ps

$ psbook test.ps > book.ps
[1] [2] [3] [4] Wrote 4 pages

$ psnup book.ps > nup.ps
psnup: output paper size not set, and could not get default paper size

$ psnup -p A4 book.ps > nup.ps
Use of uninitialized value in subroutine entry at /usr/share/psutils/PSUtils.pm line 80.
Use of uninitialized value in subroutine entry at /usr/share/psutils/PSUtils.pm line 81.
psnup: margin is too large

$ psnup -p A4 -P a4 book.ps > nup.ps
Use of uninitialized value in subroutine entry at /usr/share/psutils/PSUtils.pm line 80.
Use of uninitialized value in subroutine entry at /usr/share/psutils/PSUtils.pm line 81.
Use of uninitialized value in subroutine entry at /usr/share/psutils/PSUtils.pm line 80.
Use of uninitialized value in subroutine entry at /usr/share/psutils/PSUtils.pm line 81.
psnup: margin is too large

Build fails with help2man: can't get `--help' info from ./psbook

From commit 08fd370, I cannot not anymore build psutils.
make check fails with messages like

if ( touch psbook.1.w && rm -f psbook.1.w; ) >/dev/null 2>&1; then \
  ./pre-inst-env ./build-aux/missing --run /usr/bin/help2man --no-info \
	--include=./psbook-include.man \
	--include=./man-include.man \
	--output=psbook.1 ./psbook; \
fi
help2man: can't get `--help' info from ./psbook
Try `--no-discard-stderr' if option outputs to stderr
make: *** [Makefile:1342: psbook.1] Error 2

If I try on the command line

$ ./build-aux/missing --run /usr/bin/help2man --no-info \
	--include=./psbook-include.man \
	--include=./man-include.man \
	--output=psbook.1 ./psbook

it runs without errors and psbook.1 has content that man understands.
But if I prefix it with ./pre-inst-env, it fails with the previous error.

Maybe, it is a problem with my environment.

$ help2man --version
GNU help2man 1.47.11

Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2009, 2010,
2011, 2012, 2013, 2014, 2015, 2016, 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Written by Brendan O'Dea <[email protected]>

Incorrect mediasize with psresize

psresize does not change to mediasize
I'm not sure whether that is the intended behavior. Could not find any clear docs, so filing an issue.
I'm trying to resize an a1 document to a4 with psresize. While the output is scaled, the DocumentMedia is unchanged as a result I get a cropped output when viewing on evince.

Version Used:
psresize release 1 patchlevel 17 (Ubuntu bionic default) and
psresize 2.04 latest github release

Resize command:
psresize -PA1 -pa4 test.ps test1.ps

Header of original file:
%!PS-Adobe-2.0
%%Creator: dvips(k) 5.999 Copyright 2019 Radical Eye Software
%%Title: test.dvi
%%CreationDate: Wed Mar 31 10:38:44 2021
%%Pages: 1
%%PageOrder: Ascend
%%BoundingBox: 0 0 1684 2384
%%DocumentFonts: CMBX12 CMR10 CMTI10
%%DocumentPaperSizes: a1
%%EndComments

Header of resized file
%!PS-Adobe-2.0
%%Creator: dvips(k) 5.999 Copyright 2019 Radical Eye Software
%%Title: test.dvi
%%CreationDate: Wed Mar 31 10:38:44 2021
%%DocumentMedia: plain 1684 2382 0 () ()
%%BoundingBox: 0 0 1684 2382
%%Pages: 1 0
%%PageOrder: Ascend
%%DocumentFonts: CMBX12 CMR10 CMTI10
%%EndComments

Expected Behavior:
The resized/output file should have %%DocumentMedia properties of a4 paper and not of a1 paper.

Solution:
Manually editing the %%DocumentMedia: to "A4 595 842 0 () ()" solves the problem. I've almost no idea on ps specs so please excuse me if this is intentional or something like that.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.