[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why does groff require psutils?
From: |
Alexis |
Subject: |
Re: Why does groff require psutils? |
Date: |
Sun, 26 Nov 2023 12:28:25 +0100 |
Hi all,
from what I understand the "psselect" command is used by the groff html
preprocessor to extract *a single page* from a multi-page Postscript
document. I think the same could be achieved using ghostscript,
which groff already depends on and uses.
Note that I know little about psutils, ghostscript, and Postscript,
so please take the following with a block rather than a grain of salt.
> If someone knows of a replacement for psselect, possibly in a more
> widely deployed and used package, we could conceivably transition to it.
> This would require some testing.
First tests (see minimal working example (MWE) below) suggest that
psselect can be replaced with ghostscript's ps2ps or gs command.
Would replacing the following in src/preproc/html/pre-html.cpp
s = make_string("psselect -q -p%d %s %s\n",
pageno, psFileName, psPageName);
with
s = make_string("ps2ps -dFirstPage=%1$d -dLastPage=%1$d %s %s\n",
pageno, psFileName, psPageName);
or
s = make_string("echo showpage | "
"%s%s -q -dBATCH -dSAFER "
"-dFirstPage=%3$d -dLastPage=%3$d "
"-sDEVICE=ps2write "
"-sOutputFile=%s %s\n",
image_gen,
EXE_EXT,
pageno,
psPageName,
psFileName);
seem feasible for a medium or even short term transition if the
suggested commands are a worthy equivalent for how psselect is used
in groff?
Please find attached a Makefile as a MWE that:
- generates a multi-page Postscript document using groff
- extracts a page using psselect writing it to psselect-psPageName.ps
- extracts a page using ps2ps writing it to ps2ps-psPageName.ps
- extracts a page using gs writing it to psPageName.ps
The MWE requires make, seq, groff, ghostscript, and psselect.
The support for pdf conversion is added for those who have the
(mis)fortune of working on macOS, which sadly has removed support
for PostScript.
Best
Alexis
Makefile
Description: Text document