Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
0
votes
0
answers
138
views
How to Make a Custom Banner Page on CUPS on Linux?
On macOS, the creation of banner pages for cups is simple: you create a file prepended with #CUPS-BANNER and then write certain parameters for headers, footers, and information to be displayed. Example from [CUPS' website](https://www.cups.org/doc/spec-banner.html): ``` #CUPS-BANNER # What to show o...
On macOS, the creation of banner pages for cups is simple: you create a file prepended with
#CUPS-BANNER
and then write certain parameters for headers, footers, and information to be displayed. Example from [CUPS' website](https://www.cups.org/doc/spec-banner.html) :
#CUPS-BANNER
# What to show on the cover page
Show job-id job-name job-originating-user-name time-at-creation
# The header and footer text
Header Cover Page
Footer Cover Page
# Arbitrary "notice" text
Notice All work and no play makes Johnny a dull boy.
Notice All work and no play makes Johnny a dull boy.
Notice All work and no play makes Johnny a dull boy.
Notice All work and no play makes Johnny a dull boy.
# Images to place below the rest
Image /usr/share/doc/cups/images/cups-icon.png
Image /usr/share/doc/cups/images/smiley.jpg
This is how the all job sheets are stored.
On linux, CUPS banners are stored in files called _PDF_ banners. These banners draw from some template that is a pdf file and contain certain attributes (example from my system):
#PDF-BANNER
Template secret.pdf
Show printer-name printer-info printer-location printer-make-and-model printer-driver-name printer-driver-version paper-size imageable-area job-id options time-at-creation time-at-processing
_(/usr/share/cups/banners/secret
and template is at /usr/share/cups/data/secret.pdf
)_
The question for me is how to make my own PDF banner for printing. On macOS the answer is obvious but on Linux it is considerably harder because I don't know what is done to these template PDFs to make them filled in dynamically in such a way. I even heard somewhere that CUPS supports postscript and ascii banners.
Thank's for answering!
## System info
Linux: fedora asahi remix 40 on a macbook pro with m1 pro chip
CUPS: v2.4.10
All tests are printed using the Cups-PDF virtual printer
Ben Raz
(1 rep)
Mar 5, 2025, 08:37 PM
3
votes
2
answers
1583
views
Preventing mid-word line breaks in a2ps
So I understand that `a2ps` is mostly for converting ASCII code to postscript for printing, but occasionally I like to print a .txt or .md file for school. Often, an entire sentence (or even a paragraph) will be on one line, and `a2ps` will break the line at whatever character it needs to in order t...
So I understand that
a2ps
is mostly for converting ASCII code to postscript for printing, but occasionally I like to print a .txt or .md file for school. Often, an entire sentence (or even a paragraph) will be on one line, and a2ps
will break the line at whatever character it needs to in order to wrap correctly.
This often leaves either awkward half words on a line, or spaces immediately at the beginning of the line. I can't seem to find an option to prevent this hard wrapping in the middle of words (even with --pretty-print
).
Is there any option to do this, or am I using the incorrect tool for the task?
afischer
(33 rep)
Sep 21, 2014, 02:57 PM
• Last activity: Jan 3, 2025, 08:44 PM
7
votes
5
answers
14850
views
printing problems with DDST (aka PCL6) printer RICOH Aficio SP C240DN
I'm having big problems printing on a RICOH Aficio SP C240DN (a color laser printer). CUPS/OpenPrinting doesn't have a driver for exactly this printer. There are similar numbers but not 240DN. It also seems there is no PPD file for this printer, as it doesn't accept PostScript at all. There are only...
I'm having big problems printing on a RICOH Aficio SP C240DN (a color laser printer). CUPS/OpenPrinting doesn't have a driver for exactly this printer. There are similar numbers but not 240DN.
It also seems there is no PPD file for this printer, as it doesn't accept PostScript at all. There are only so-called DDST and ICM drivers for Windows and Mac , but no PPD as opposed to slightly older models from RICOH (320DN for example). The technician at the company where I bought the printer said that DDST is a stripped-down version of PCL6.
The connection to the printer works, I can access the web interface for management, I can print test pages via buttons on the printer or via the web interface. If I try any other driver (320DN for example), the printer shows that it is receiving data, the spool on the computer is processing, and then it just thinks the job is finished and done but the printer does nothing.
I'm planning to return it, but was wondering if somebody could explain a bit about drivers (what is DDST?), and if somebody knows if there is any chance that such driver for Linux will be out in any time soon.
I'm actually ready to donate a small amount to somebody who would hack an open-source driver (for CUPS).
Luka
(81 rep)
Aug 21, 2012, 02:39 PM
• Last activity: Oct 24, 2024, 10:12 PM
21
votes
2
answers
13031
views
Export a man page in pdf
Doing `man -t man > man.ps` will export the man page for man in postscript. How can I export it in PDF? I have gone through the manuals and learnt about the `-T` option but it's a bit unclear to me.
Doing
man -t man > man.ps
will export the man page for man in postscript.
How can I export it in PDF?
I have gone through the manuals and learnt about the -T
option but it's a bit unclear to me.
Neo_Returns
(589 rep)
May 19, 2018, 07:57 AM
• Last activity: Oct 20, 2024, 09:19 AM
0
votes
0
answers
72
views
What PS driver to use with cups-pdf?
cups-pdf has known issue that text can not be searched or copied from generated PDF files. I think that using proper PS driver should solve issue. I think that because I noticed that cups-pdf can print proper PDF file if proper ps file is printed. I executed following test. I created cups-pdf printe...
cups-pdf has known issue that text can not be searched or copied from generated PDF files.
I think that using proper PS driver should solve issue. I think that because I noticed that cups-pdf can print proper PDF file if proper ps file is printed. I executed following test.
I created cups-pdf printer
lpadmin -p p1 -v cups-pdf:/p1 -E -P /usr/share/ppd/cups-pdf/CUPS-PDF_opt.ppd
There is testPage.txt text file. I have converted it to ps files in three ways.
enscript testPage.txt -o testPage_enscript.ps
a2ps testPage.txt -o testPage_a2ps.ps
lpadmin -p ps -v file:///cups/prints/testPage_psprinter.ps -E -m drv:///sample.drv/generic.ppd
lp -d ps testPage.txt
I printed all 3 ps files on cups-pdf printer.
lp -d p1 testPage_enscript.ps
lp -d p1 testPage_a2ps.ps
lp -d p1 testPage_psprinter.ps
testPage_enscript.ps and testPage_a2ps.ps were printed correctly, text is searchable and can be copied. Only testPage_psprinter.ps was printed to invalid PDF file, text is not searchable and can not be copied.
As I understand cups-pdf is a PostScript printer. Any client that prints something on printer uses printer driver. In cups-pdf case driver coverts any document to postscript and next cups-pdf converts postscript to PDF. Am I right? It seems that the key to solving the problem is using the right PS driver. I have checked following drivers without success.
1. Generic PostScript Level 1 Printer Foomatic/Postscript1 (recommended) (color, 2-sided printing)
2. Generic PostScript Printer Foomatic/Postscript (recommended) (color, 2-sided printing)
3. HP LaserJet 9000 Series Postscript (recommended) (grayscale)
Is there any PS driver that works properly with cups-pdf?
Mariusz
(369 rep)
Sep 26, 2024, 10:29 AM
4
votes
1
answers
670
views
Displaying orbital node characters in groff ms macros
I'm trying to display the characters for ascending and descending orbital nodes (☊ and ☋) in groff, however when I export the document to postscript they simply don't show.
I'm trying to display the characters for ascending and descending orbital nodes (☊ and ☋) in groff, however when I export the document to postscript they simply don't show.
GeriatricJacob
(41 rep)
Jul 31, 2019, 01:20 AM
• Last activity: Sep 22, 2024, 07:02 AM
0
votes
0
answers
66
views
Font embedding with Libreoffice (eps files)
I would like to generate an eps file with embedded fonts, to make sure that the font I am using in Linux (Nimbus Sans) will look the same when the file is opened on a non-Linux (e.g. Windows) PC. I am creating the file using Libreoffice Draw. I have two closely-related questions: 1) If I enable 'fon...
I would like to generate an eps file with embedded fonts, to make sure that the font I am using in Linux (Nimbus Sans) will look the same when the file is opened on a non-Linux (e.g. Windows) PC. I am creating the file using Libreoffice Draw. I have two closely-related questions:
1) If I enable 'font embedding' in the Libreoffice file settings, is that just for saving the project as a .odg file, or will that also embed the fonts if I export to a .eps file?
2) Is there a simple way I can verify if the Nimbus Sans font did indeed get embedded in the exported .eps file?
Time4Tea
(2628 rep)
Jul 1, 2024, 03:06 PM
-1
votes
1
answers
178
views
ps2pdf vs. ps2pdfwr
To convert a PostScript file to PDF, I can use either - `ps2pdf input.ps output.pdf` - `ps2pdfwr input.ps output.pdf` But what is the real practical difference between the two? I do know `ps2pdf` provide the `-dCompatibility=1.x` switch in the command line, whereas `man ps2pdfwr` describes its usage...
To convert a PostScript file to PDF, I can use either
-
ps2pdf input.ps output.pdf
- ps2pdfwr input.ps output.pdf
But what is the real practical difference between the two? I do know ps2pdf
provide the -dCompatibility=1.x
switch in the command line, whereas man ps2pdfwr
describes its usage as to convert PostScript to PDF without specifying CompatibilityLevel.
But does it mean the only real difference between them is that the former does provide the -dCompatibility
switch, whereas the latter doesn't? I think the answer is "no" (because in such a case developing the latter utility would be quite a silly idea), and this is why I want someone to exlain me all their practical differences between the two and pros/contras/pitfalls.
jsx97
(1347 rep)
Jun 7, 2024, 01:25 PM
• Last activity: Jun 7, 2024, 02:09 PM
1
votes
1
answers
63
views
Converting non-English manual pages to PDF/PostScript
I'm trying to convert manual pages containing either Japanese or Russian characters to the PDF/PostScript formats. I'm doing it with the following commands. `man -Tpdf /usr/share/man/ja/man1/vim.1.gz > vim-ja.pdf` `man -t /usr/share/man/ja/man1/vim.1.gz > vim-ja.ps` `man -Tpdf /usr/share/man/ru.UTF-...
I'm trying to convert manual pages containing either Japanese or Russian characters to the PDF/PostScript formats. I'm doing it with the following commands.
man -Tpdf /usr/share/man/ja/man1/vim.1.gz > vim-ja.pdf
man -t /usr/share/man/ja/man1/vim.1.gz > vim-ja.ps
man -Tpdf /usr/share/man/ru.UTF-8/man1/vim.1.gz > vim-ru.pdf
man -t /usr/share/man/ru.UTF-8/man1/vim.1.gz > vim-ru.ps
These commands return a bunch of warnings of the following form.
troff: :2: warning: can't find special character 'u540D'
The resulting documents do not contain characters of the specified languages. Only English characters appear in the documents.
How to properly convert manual pages containing non-English characters to PDF/PostScript?
Shamaoke
(221 rep)
Jun 7, 2023, 08:53 AM
• Last activity: Jun 7, 2023, 01:56 PM
4
votes
0
answers
131
views
several eps to ps
I have a bunch of eps vector images (btw... they are generated from dxf), and want to stack them on a single ps so I can print them on a single sheet. The eps files share the same dimensions but have slightly different content. I'm looking for or want to write a script that I can give parameters lik...
I have a bunch of eps vector images (btw... they are generated from dxf), and want to stack them on a single ps so I can print them on a single sheet. The eps files share the same dimensions but have slightly different content.
I'm looking for or want to write a script that I can give parameters like x,y offsets, and it'll place the eps's on a grid.
I was thinking using LaTeX, but I guess it is a bit overkill.
Lev
(41 rep)
Jul 29, 2017, 09:13 AM
• Last activity: May 31, 2023, 01:44 PM
11
votes
3
answers
51392
views
what is the command to display .eps files?
I'm have a file called `t-0.8.eps`. How can I open this file in the shell? I am using Mac and when I click `.eps` files the preview (the name of the software to read PDFs) says failed.
I'm have a file called
t-0.8.eps
.
How can I open this file in the shell?
I am using Mac and when I click .eps
files the preview (the name of the software to read PDFs) says failed.
Meva
(393 rep)
Jan 30, 2014, 01:54 PM
• Last activity: Mar 20, 2023, 10:29 AM
9
votes
2
answers
21197
views
Conversion of PDF to PS
I'm quite new to shell scripting. I need to create a script or reuse a script that converts PDF to PS (Post Script) files, is there anyway this can be done?
I'm quite new to shell scripting.
I need to create a script or reuse a script that converts PDF to PS (Post Script) files, is there anyway this can be done?
Perry
(101 rep)
Mar 3, 2016, 10:01 AM
• Last activity: Nov 11, 2022, 12:31 PM
2
votes
0
answers
605
views
How do I rotate the orientation in the ghostscript plot for ps file?
I am plotting the (postscript) ps file using the ghostscript in the terminal. When I use the command"gs file.ps", it always gives the portrait orientation like following [![enter image description here][1]][1] do you know how could I rotate the plot with 90 degrees with landscape orientation? thanks...
I am plotting the (postscript) ps file using the ghostscript in the terminal.
When I use the command"gs file.ps", it always gives the portrait orientation like following
do you know how could I rotate the plot with 90 degrees with landscape orientation? thanks a lot.

徐世博
(21 rep)
Mar 20, 2019, 05:40 PM
• Last activity: Sep 21, 2022, 10:53 AM
0
votes
0
answers
1086
views
Evince is displaying correctly but is printing incorrectly
I was given a structural engineering PDF document with some yellow highlighted text which displays correctly in Evince like this: [![enter image description here][1]][1] But when I try to print that same page it shows the yellow, but not the hi-lighted black text, so it ends up printing like this: [...
I was given a structural engineering PDF document with some yellow highlighted text which displays correctly in Evince like this:
But when I try to print that same page it shows the yellow, but not the hi-lighted black text, so it ends up printing like this:
Thus missing the text "SEISMIC DESIGN CATEGORY...".
The same problem occurs if I try and preview the text before printing, where the preview is surprisingly wrong, or if I print to a PDF file and then try to open that file with Evince to view or print it.
----------
**With a little hacking I did find two workarounds** 1) print that page to a postscript file (*.ps) and then open that postscript file with Evince and then printing works correctly for this document. 2) Use Okular which seems to print this just fine. (I'm now guessing this is an Evince bug.)
So it seems like the Evince pdf to postscript conversion when printing is a bit off, but ok when you print pdf to ps.
Is there is a better solution where printing from Evince doesn't stumble, so I don't have to worry that what's printed is different from what's on the screen?
----------
*I'm running Debian 10, my Evince version is 3.30.2, and I'm printing to an hp4020 printer with CUPS, which is all I've got to test it with at the moment.*


Elliptical view
(4349 rep)
Aug 25, 2021, 10:25 PM
• Last activity: Apr 26, 2022, 08:35 PM
1
votes
1
answers
2089
views
Cannot open X display `(null)'. **** Unable to open the initial device, quitting
input: gs myPSFile.ps output: GPL Ghostscript 9.50 (2019-10-15) Copyright (C) 2019 Artifex Software, Inc. All rights reserved. This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY: see the file COPYING for details. GPL Ghostscript 9.50: Cannot open X display `(null)'. **** Unabl...
input:
gs myPSFile.ps
output:
GPL Ghostscript 9.50 (2019-10-15)
Copyright (C) 2019 Artifex Software, Inc. All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
GPL Ghostscript 9.50: Cannot open X display `(null)'.
**** Unable to open the initial device, quitting.
why?
I have windows 10.
I'm using git bash to ssh into my school's internal tux server.
What I tried:
I saw 3 or 4 other duplicate questions on many other sites. I have no idea what is going on.
solidwaterslayer
(11 rep)
Sep 21, 2021, 06:15 PM
• Last activity: Sep 21, 2021, 06:33 PM
2
votes
1
answers
753
views
Locate enscript reported non-printable chars
I'm making a postscript of a bunch of C code, and `enscript` reports I have 2 non-printable chars [ 91 pages * 1 copy ] left in a.ps 2 non-printable characters non-printable character codes (decimal): 128 153 However I couldn't find these chars with `grep` grep -r $'\231' * grep -r $'\200' * Is ther...
I'm making a postscript of a bunch of C code, and
enscript
reports I have 2 non-printable chars
[ 91 pages * 1 copy ] left in a.ps
2 non-printable characters
non-printable character codes (decimal):
128 153
However I couldn't find these chars with grep
grep -r $'\231' *
grep -r $'\200' *
Is there a way to let enscript
report which lines contain the non-printable chars?
Wei Shi
(143 rep)
Apr 16, 2012, 06:56 PM
• Last activity: Jun 9, 2021, 03:32 PM
1
votes
1
answers
121
views
How do I output an individual eqn described equation to a .ps or .eps?
I would like to reuse the output from eqn to get PS or EPS files which contains just the equation and not a complete A4 with the equation. If I try: $ cat test.eqn .EQ For ~ y=1 ~ -> ~ L( y hat , y) = -log( y hat ) ~ -> ~ if ~ y hat approx 1 ~ then ~ L( y hat , y ) approx 0 .EN $ cat test.eqn | eqn...
I would like to reuse the output from eqn to get PS or EPS files which contains just the equation and not a complete A4 with the equation.
If I try:
$ cat test.eqn
.EQ
For ~ y=1 ~ -> ~ L( y hat , y) = -log( y hat ) ~ -> ~ if ~ y hat approx 1 ~ then ~ L( y hat , y ) approx 0
.EN
$ cat test.eqn | eqn | groff -Tps > test.ps
I get
test.ps
generated and I can see the equation properly formatted, but it is displayed as part of a complete page (either A4 or letter size).
What shall be done to get just a document which contains just the required size to contain the equation? i.e. the whole page would had been cropped to the necessary space to contain the equation.
Additionally, if I try to use troff
instead of groff
I can not manage to get PS code, why? (FreeBSD 12).
M.E.
(631 rep)
May 9, 2021, 07:39 PM
• Last activity: May 10, 2021, 06:44 AM
2
votes
1
answers
981
views
How can I include a pic figure as external file in groff?
While using `groff` and `pic` it is possible to do: $ cat test.ms .TL Test .NH 1 Test Header .PS circle arrow box .PE $ cat test.ms | groff -ms -p > test.ps Which generates a valid `test.ps` file containing the processed figure in `pic`. In larger documents, for mainteinability, it might be desirabl...
While using
groff
and pic
it is possible to do:
$ cat test.ms
.TL
Test
.NH 1
Test Header
.PS
circle
arrow
box
.PE
$ cat test.ms | groff -ms -p > test.ps
Which generates a valid test.ps
file containing the processed figure in pic
.
In larger documents, for mainteinability, it might be desirable to keep the picture pic
description in a separate file and invoke such file from the main .ms
file.
While trying to get this working I have found that .so
can source an external file, but I am finding issues to set up this configuration of embeding external .pic
files into the main .ms
file as shown here:
$ cat test2.pic
.PS
circle
arrow
box
.PE
$ cat test2.ms
.TL
Test
.NH 1
Test Header
.so test2.pic
$ cat test2.ms | groff -ms -p > test2.ps
test2.pic:1: macro error: bad arguments to PS (not preprocessed with pic?)
$
Which would be the way to achieve this inclusion of .pic
code in the main macro .ms
files as external files?
M.E.
(631 rep)
May 7, 2021, 10:49 PM
• Last activity: May 8, 2021, 01:06 AM
0
votes
0
answers
382
views
Is it possible to convert a pdf file to post script, then to text for see codes used in post script?
I have one pdf file where text have been formatted in tables, boxes, background colours. I tried to convert my text file to pdf with boxes, tables and background colours with enscript. I got success for foreground and background colours, but no tables and boxes. So I converted one pdf file to post-s...
I have one pdf file where text have been formatted in tables, boxes, background colours. I tried to convert my text file to pdf with boxes, tables and background colours with enscript. I got success for foreground and background colours, but no tables and boxes. So I converted one pdf file to post-script to see what codes had been used for creating/inserting tables and boxes with text. I got success with PS codes but these are very difficult to understand. Then I converted .ps file to text, but now I can not see codes. I am hoping after understand post-script code I will use the same with
awk
as usual for pdf conversion. But no success. Is there any tool or command so I can see exact code used in post-script with text editor? I am using red hat linux 5.9.
Kalpesh Bhoj
(192 rep)
Jul 28, 2020, 12:11 PM
• Last activity: Jul 28, 2020, 12:29 PM
3
votes
1
answers
1615
views
How do I set up a PostScript print queue to share a PCL laser printer and add PS fonts?
I would like to take a $100 PCL-compatible laser printer and hook it to my home network either through Wi-Fi or by connecting it directly to a Linux server by USB. Instead of using the manufacturer-provided drivers, though, I want to be able to print PostScript documents directly. I imagine I will w...
I would like to take a $100 PCL-compatible laser printer and hook it to my home network either through Wi-Fi or by connecting it directly to a Linux server by USB. Instead of using the manufacturer-provided drivers, though, I want to be able to print PostScript documents directly. I imagine I will want to set up a print queue, GhostScript, and an IP address and port at which I can point other machines on the network.
Also, I have a stack of CDs with PostScript fonts on them, and I would like to make these available to any machine that wants to print to the networked printer. I'm guessing this is done by copying the fonts somewhere where GhostScript can find them.
Basically, I want to make the cheap printer look to other machines on the network like an old-school expensive PostScript-capable networked laser with lots of built-in fonts, like one of the high-end LaserWriters that Apple used to sell.
In the old days with dot matrix printers and HP LaserJet printers that only had a parallel interface this sort of thing was common, but it seems like it's actually more obscure now that most printers are network-capable out of the box and are configured through a GUI. In particular I think I have an idea how I would have done the GhostScript setup with LPD by defining filters, but now all Linux distros seem to have CUPS installed out of the box.
dodgethesteamroller
(176 rep)
Feb 28, 2014, 02:39 AM
• Last activity: Jul 3, 2020, 01:05 AM
Showing page 1 of 20 total questions