Operating System - HP-UX
1753278 Members
5543 Online
108792 Solutions
New Discussion юеВ

Re: print pdf using ghostscript.

 
Barakati
Frequent Advisor

print pdf using ghostscript.

Hi Experts,

I want to print pdf on epson dot matrix printer. This printer uses "escp" language.
I tried ghostscript 8.62 on HP_UX itanium

i used like following.
gs -q -dNOPAUSE -dSAFER -sOutputFile=/tmp/out.prn @stcany.upp alphabet.pdf quit.ps

/tmp/out.prn:

^[^A@EJL 1284.4
@EJL
^[@^[@^[(G^A^A^[(i^A^A^[(U^A
^[U^[(C^Bx^O^[(c^D-M-0^N^[@^L


alphabet.pdf:

It is very long file with complete alphabet(capital and small) and numbers.
I mean for this file the out.prn must be quite lenghty.

Could any body kindly help me to get the output in escp format which is a language for EPSON DFX 9000 printer.

Thanks and appreciating your kind help.
7 REPLIES 7
Matti_Kurkela
Honored Contributor

Re: print pdf using ghostscript.

The stcany.upp file included in the ghostscript distribution contains definitions for Epson Stylus Color series printers. For a black-and-white printer like DFX 9000 they might be incorrect. At best, these settings would include extra complexity, which is best avoided in the current situation.

Ghostscript 8.62 lists its available output formats with "gs -h". At least on my Debian workstation, "escp" is included in the list.

Also omit the "quit.ps" from your command line, use -dBATCH instead. (quit.ps is deprecated: -dBATCH is the current way to achieve the same thing)

I would start with a command line like this:

gs -q -dNOPAUSE -dSAFER -dBATCH -sDEVICE=escp -sOutputFile=/tmp/out2.prn alphabet.pdf

You will probably have to add the option "-rXRESxYRES", where XRES and YRES should be the printer resolution in horizontal and vertical directions, in number of dots per inch. For your printer, try "-r240x72".

The printer database of openprinting.org mainly talks about printing on Linux (and other open-source systems), but it's a nice place to find basic information on many printers:

http://www.openprinting.org/show_printer.cgi?recnum=Epson-DFX-9000

As it suggests, you might also try configuring the printer for IBM Proprinter emulation and then use the "-sDEVICE=ibmpro" option instead of "-sDEVICE=escp".

MK
MK
Barakati
Frequent Advisor

Re: print pdf using ghostscript.

Thanks for your reply.

I have tried all the options you mentioned.

gs -q -dNOPAUSE -dSAFER -sDEVICE=ibmpro -r240x72 -sOutputFile=/tmp/out2.prn alphabet.pdf
Out2.prn:
^Q^[30^L

ii)gs -q -dNOPAUSE -dSAFER -sDEVICE=escp -r240x72 -sOutputFile=/tmp/out2.prn alphabet.pdf
out:
^[*rbC^[*t240R^L^[@


iii)gs -q -dNOPAUSE -dSAFER -sDEVICE=epson -r240x72 -sOutputFile=/tmp/out2.prn alphabet.pdf
OUt:
^[@^[P^[l^[QW^L^[@


Kindly help me.
Matti_Kurkela
Honored Contributor

Re: print pdf using ghostscript.

The .prn files will definitely contain control codes that are likely to mess up the display output if you use something like "cat" or "more". If the files contain a Control-D character, some tools will interpret it as "end-of-file" and may stop the output prematurely.

What are the file lengths, as reported by the "ll" directory listing? If the files are longer than the displayed data, you are definitely not seeing the whole truth with the tool you've been using to view the files.

For a better view of the .prn file contents, you could use a command like "od -t x1c out2.prn" or "od -t x1a out2.prn". These commands will display a hexadecimal representation of each character and will replace the control characters with printable character names. The od command will also assume that the input is some unknown binary data and will not assume Ctrl-D means end-of-file.

What happens if you try to send the out2.prn file to the printer?

Where did you get your Ghostscript version from? Is it compiled with support for PDF format input? (What is the output of "gs -h" command?)

Could you attach a copy of the alphabet.pdf file to this thread? I could then try to reproduce your output.

MK
MK
Barakati
Frequent Advisor

Re: print pdf using ghostscript.

Thanks and i appreciate your continuous support.

The sizes for the files with different options i have used are

-rw-rw-rw- 1 root sys 5 Mar 11 14:42 /tmp/out2.prn
-rw-rw-rw- 1 root sys 15 Mar 11 14:42 /tmp/out2.prn
-rw-rw-rw- 1 root sys 14 Mar 11 14:42 /tmp/out2.prn

that is 5, 15, 14 bytes respectively.


The outpud using od:

# od -tx1c /tmp/out2.prn
0000000 11 1b 33 30 c
021 033 3 0 \f
0000005

I just installed followed the following weblink to install ghostscript i do not know whether i added pdf support or not.

Home URL: ftp://ftp.mirrorservice.org/pub/gnu/ghostscript/

I have attached the alphabet.pdf.
But it is just a sample pdf file to test. I want to produce such format for any pdf file.

Thanks a lot.
Barakati
Frequent Advisor

Re: print pdf using ghostscript.

#gs -h
GPL Ghostscript 8.62 (2008-02-29)
Copyright (C) 2008 Artifex Software, Inc. All rights reserved.
Usage: gs [switches] [file1.ps file2.ps ...]
Most frequently used switches: (you can use # in place of =)
-dNOPAUSE no pause after page | -q `quiet', fewer messages
-gx page size in pixels | -r pixels/inch resolution
-sDEVICE= select device | -dBATCH exit after last file
-sOutputFile= select output file: - for stdout, |command for pipe,
embed %d or %ld for page #
Input formats: PostScript PostScriptLevel1 PostScriptLevel2 PostScriptLevel3 PDF
Default output device: bbox
Available devices:
alc1900 alc2000 alc4000 alc4100 alc8500 alc8600 alc9100 ap3250 appledmp
atx23 atx24 atx38 bbox bit bitcmyk bitrgb bitrgbtags bj10e bj10v bj10vh
bj200 bjc600 bjc800 bjc880j bjccmyk bjccolor bjcgray bjcmono bmp16 bmp16m
bmp256 bmp32b bmpgray bmpmono bmpsep1 bmpsep8 ccr cdeskjet cdj1600 cdj500
cdj550 cdj670 cdj850 cdj880 cdj890 cdj970 cdjcolor cdjmono cfax cgm24
cgm8 cgmmono chp2200 cif cljet5 cljet5c cljet5pr coslw2p coslwxl cp50
declj250 deskjet devicen dfaxhigh dfaxlow dj505j djet500 djet500c dl2100
dnj650c epl2050 epl2050p epl2120 epl2500 epl2750 epl5800 epl5900 epl6100
epl6200 eps9high eps9mid epson epsonc epswrite escp escpage faxg3 faxg32d
faxg4 fmlbp fmpr fs600 gdi hl1240 hl1250 hl7x0 hpdj1120c hpdj310 hpdj320
hpdj340 hpdj400 hpdj500 hpdj500c hpdj510 hpdj520 hpdj540 hpdj550c
hpdj560c hpdj600 hpdj660c hpdj670c hpdj680c hpdj690c hpdj850c hpdj855c
hpdj870c hpdj890c hpdjplus hpdjportable ibmpro ijs imagen imdi inferno
iwhi iwlo iwlq jetp3852 jj100 jpeg jpegcmyk jpeggray la50 la70 la75
la75plus laserjet lbp310 lbp320 lbp8 lex2050 lex3200 lex5700 lex7000
lips2p lips3 lips4 lips4v lj250 lj3100sw lj4dith lj4dithp lj5gray lj5mono
ljet2p ljet3 ljet3d ljet4 ljet4d ljet4pjl ljetplus ln03 lp1800 lp1900
lp2000 lp2200 lp2400 lp2500 lp2563 lp3000c lp7500 lp7700 lp7900 lp8000
lp8000c lp8100 lp8200c lp8300c lp8300f lp8400f lp8500c lp8600 lp8600f
lp8700 lp8800c lp8900 lp9000b lp9000c lp9100 lp9200b lp9200c lp9300
lp9400 lp9500c lp9600 lp9600s lp9800c lps4500 lps6500 lq850 lx5000
lxm3200 lxm5700m m8510 mag16 mag256 md1xMono md2k md50Eco md50Mono md5k
mgr4 mgr8 mgrgray2 mgrgray4 mgrgray8 mgrmono miff24 mj500c mj6000c
mj700v2c mj8000c ml600 necp6 npdl nullpage oce9050 oki182 oki4w okiibm
omni oprp opvp paintjet pam pbm pbmraw pcl3 pcx16 pcx24b pcx256 pcx2up
pcxcmyk pcxgray pcxmono pdfwrite pgm pgmraw pgnm pgnmraw photoex picty180
pj pjetxl pjxl pjxl300 pkm pkmraw pksm pksmraw plan9bm png16 png16m
png256 png48 pngalpha pnggray pngmono pnm pnmraw ppm ppmraw pr1000
pr1000_4 pr150 pr201 ps2write psdcmyk psdrgb psgray psmono psrgb pswrite
pxlcolor pxlmono r4081 rpdl samsunggdi sgirgb sj48 spotcmyk st800 stcolor
sunhmono t4693d2 t4693d4 t4693d8 tek4696 tiff12nc tiff24nc tiff32nc
tiffcrle tiffg3 tiffg32d tiffg4 tiffgray tifflzw tiffpack tiffsep
uniprint wtscmyk wtsimdi xcf xes
Search path:
. : %rom%lib/ : /usr/local/share/ghostscript/8.62/lib :
/usr/local/share/ghostscript/8.62/Resource :
/usr/local/share/ghostscript/fonts :
/usr/local/share/fonts/default/ghostscript :
/usr/local/share/fonts/default/Type1 :
/usr/local/share/fonts/default/TrueType : /usr/lib/DPS/outline/base :
/usr/openwin/lib/X11/fonts/Type1 : /usr/openwin/lib/X11/fonts/TrueType
Initialization files are compiled into the executable.
For more information, see /usr/local/share/ghostscript/8.62/doc/Use.htm.
Please report bugs to bugs.ghostscript.com.
#
Matti_Kurkela
Honored Contributor

Re: print pdf using ghostscript.

The PDF file you attached seems very short: just 1993 bytes.

When viewing your .pdf using xpdf on my Linux workstation, I don't see an alphabet: I see just a blank page.

If I use the latest official Adobe Reader for Linux, the result is the same.

In Adobe Reader, the File -> Properties dialog indicates the .pdf is produced by "GPL Ghostscript 8.62"???

Please re-check your alphabet.pdf or use another pdf document for ghostscript testing.

MK
MK
Court Campbell
Honored Contributor

Re: print pdf using ghostscript.

I have never had good luck with ghostscript on hpux. In the past I have setup a linux server and created a pdf printer. Then shared it out and had the hpux server print to it for pdf files. Another option may be to install acrobat reader and use the switched to output to a ps file.
"The difference between me and you? I will read the man page." and "Respect the hat." and "You could just do a search on ITRC, you don't need to start a thread on a topic that's been answered 100 times already." Oh, and "What. no points???"