Operating System - HP-UX
1753384 Members
5660 Online
108792 Solutions
New Discussion юеВ

Re: Batch PDF Printing to PostScript Printer

 
SOLVED
Go to solution
Jeff Carlin
Frequent Advisor

Batch PDF Printing to PostScript Printer

We need to batch convert PDF files to PostScript for printing. We're running hp-ux 11.11. I researched some other posts here on the ITRC and started down the path of using acroreader. This worked for printing interactively, but I can't determine a way to make it work without having a DISPLAY set.

Has anyone else done this and what did you do?

I am open to using GhostScript, but I have no clue how to get it set up on my system, let alone use it.

Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
5 REPLIES 5
Dennis Handly
Acclaimed Contributor

Re: Batch PDF Printing to PostScript Printer

When I invoke acroread with -? I get:
-toPostScript [options] pdf_file ... [ps_dir]
-toPostScript [options] -pairs pdf_file_1 ps_file_1 ...
-toPostScript [options]
Converts the given pdf_files to PostScript.

On page 5 of the acroread help it says:

To display a list of all Acrobat Reader command-line options (UNIX), start the Acrobat Reader product with the -help option. For example: acroread -help

Page 10 has:
Printing PDF documents from the command line (UNIX)
john korterman
Honored Contributor

Re: Batch PDF Printing to PostScript Printer

Hi Jeff,

try setting the DISPLAY variable like this:
$ export DISPLAY=127.0.0.1:0

and then try acroread like this:
$ /path/to/acroread -toPostScript -shrink < /path/to/whatever.pdf | lp -d myprinter


regards,
John K.
it would be nice if you always got a second chance
Jeff Carlin
Frequent Advisor

Re: Batch PDF Printing to PostScript Printer

I had tried that, still get the error:

(acroread:27492): Gtk-WARNING **: cannot open display:
Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.
Ermin Borovac
Honored Contributor
Solution

Re: Batch PDF Printing to PostScript Printer

Try using Xvfb (virtual framebuffer X server).

$ xinit acroread -toPostscript -pairs file.pdf file.ps -- /usr/bin/X11/Xvfb :1
Jeff Carlin
Frequent Advisor

Re: Batch PDF Printing to PostScript Printer

Thanks for the identifying the xinit approach. It worked for me like this:

xinit /usr/local/bin/printpdf.sh -ld {printer} {pdf_file} -- /usr/bin/X11/Xvfb :0

I wrote a wrapper for acroread to specify the PATH and LD_LIBRARY_PATH for GTK+. It also specifies some options I needed set for acroread.

Again, thanks everyone for the help!


Where wisdom is called for, force is of little use. --Of course, a hammer does wonders for relieving stress.