CUPS printing to pdf writer from Java app fails

M

mtp

I can't print on my pdf writer using Java.

CUPS pdf writer CUPS Real printer (EPSON)
Mozilla/Dia OK OK
Java app (JEdit/...) KO OK

I followed the tutorial here:

http://www.novell.com/coolsolutions/feature/17636.html

I've modified the pdf-writer to save its input. Here is an example:

=========================================
%PDF-1.2
%Çì~O¢
5 0 obj
<</Length 6 0 R/Filter /FlateDecode>>
stream
x~\+T0Ð34R0^@A^X#9~W+~P^K^@>è^DÉendstream
endobj
6 0 obj
24
endobj
4 0 obj
<</Type/Page/MediaBox [0 0 612 792]
/Parent 3 0 R
/Resources<</ProcSet[/PDF]endobj
3 0 obj
<< /Type /Pages /Kids [
4 0 R
] /Count 1endobj
1 0 obj
<</Type /Catalog /Pages 3 0 Rendobj
2 0 obj
<</Producer(ESP Ghostscript 815.01)
/CreationDate(D:20060824103114)
/ModDate(D:20060824103114)>>endobj
xref
0 7
0000000000 65535 f
0000000300 00000 n
0000000348 00000 n
0000000241 00000 n
0000000127 00000 n
0000000015 00000 n
0000000109 00000 n
trailer
<< /Size 7 /Root 1 0 R /Info 2 0 R
/ID [(¶zxbmÇ°>~A\\ñ~L^FŠc~G)(¶zxbmÇ°>~A\\ñ~L^FŠc~G)]startxref
459
%%EOF
==========================================

Is the input empty? It has an empty Bounding box:

$ gs last_input
ESP Ghostscript 815.01 (2005-09-22)
Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
%%BoundingBox: 0 0 0 0
%%HiResBoundingBox: 0.000000 0.000000 0.000000 0.000000
GS>



Here is the log from ps2pdf in pdf-writer:

==> last_log.err <==
ESP Ghostscript 815.01: Unrecoverable error, exit code 1

==> last_log.out <==
Error: /configurationerror in --setpagedevice--
Additional information: [/ManualFeed false]
Operand stack:
--dict:3/3(L)--
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval-- --nostringval--
--nostringval-- false 1 %stopped_push 1 3 %oparray_pop
1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop
..runexec2 --nostringval-- --nostringval-- --nostringval-- 2
%stopped_push --nostringval-- 1 3 %oparray_pop --nostringval--
--nostringval-- --nostringval-- --dict:1/2(L)-- --nostringval--
2 %dict_continue
Dictionary stack:
--dict:1117/1686(ro)(G)-- --dict:0/20(G)-- --dict:106/200(L)--
Current allocation mode is local
Last OS error: 2


Thanks for any help
 
M

mtp

mtp said:
I can't print on my pdf writer using Java.

CUPS pdf writer CUPS Real printer (EPSON)
Mozilla/Dia OK OK
Java app (JEdit/...) KO OK

I followed the tutorial here:

http://www.novell.com/coolsolutions/feature/17636.html

I've modified the pdf-writer to save its input. Here is an example:

=========================================
%PDF-1.2
%Çì~O¢
5 0 obj
<</Length 6 0 R/Filter /FlateDecode>>
stream
x~\+T0Ð34R0^@A^X#9~W+~P^K^@>è^DÉendstream
endobj
6 0 obj
24
endobj
4 0 obj
<</Type/Page/MediaBox [0 0 612 792]
/Parent 3 0 R
/Resources<</ProcSet[/PDF]endobj
3 0 obj
<< /Type /Pages /Kids [
4 0 R
] /Count 1endobj
1 0 obj
<</Type /Catalog /Pages 3 0 Rendobj
2 0 obj
<</Producer(ESP Ghostscript 815.01)
/CreationDate(D:20060824103114)
/ModDate(D:20060824103114)>>endobj
xref
0 7
0000000000 65535 f
0000000300 00000 n
0000000348 00000 n
0000000241 00000 n
0000000127 00000 n
0000000015 00000 n
0000000109 00000 n
trailer
<< /Size 7 /Root 1 0 R /Info 2 0 R
/ID [(¶zxbmÇ°>~A\\ñ~L^FŠc~G)(¶zxbmÇ°>~A\\ñ~L^FŠc~G)]startxref
459
%%EOF
==========================================

Is the input empty? It has an empty Bounding box:

$ gs last_input
ESP Ghostscript 815.01 (2005-09-22)
Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Processing pages 1 through 1.
Page 1
%%BoundingBox: 0 0 0 0
%%HiResBoundingBox: 0.000000 0.000000 0.000000 0.000000
GS>



Here is the log from ps2pdf in pdf-writer:

==> last_log.err <==
ESP Ghostscript 815.01: Unrecoverable error, exit code 1

==> last_log.out <==
Error: /configurationerror in --setpagedevice--
Additional information: [/ManualFeed false]
Operand stack:
--dict:3/3(L)--
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval-- --nostringval--
--nostringval-- false 1 %stopped_push 1 3 %oparray_pop 1
3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop
.runexec2 --nostringval-- --nostringval-- --nostringval-- 2
%stopped_push --nostringval-- 1 3 %oparray_pop --nostringval--
--nostringval-- --nostringval-- --dict:1/2(L)-- --nostringval--
2 %dict_continue
Dictionary stack:
--dict:1117/1686(ro)(G)-- --dict:0/20(G)-- --dict:106/200(L)--
Current allocation mode is local
Last OS error: 2

tracing java with:

strace -f -s 1024 -v java -cp . AnotherPrintDemo 2> strace.err
....
[pid 29515] execve("/usr/bin/lpr", ["/usr/bin/lpr", "-PCUPSPDF", "-JJava
Printing", "/tmp/javaprint14556.ps"], ["LC_PAPER=...

i saved the file and i run gs on it:

$ gs /export/share/javaprint17509.ps
ESP Ghostscript 815.01 (2005-09-22)
Copyright (C) 2004 artofcode LLC, Benicia, CA. All rights reserved.
This software comes with NO WARRANTY: see the file PUBLIC for details.
Loading URWGothicL-Book font from
/usr/share/fonts/default/Type1/a010013l.pfb... 2289316 916408 1542768
237031 1 done.
....
Loading URWChanceryL-MediItal font from
/usr/share/fonts/default/Type1/z003034l.pfb... 7249160 5890780 1542768
230715 1 done.
Error: /configurationerror in --setpagedevice--
Additional information: [/ManualFeed false]
Operand stack:
--dict:3/3(L)--
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval--
--nostringval-- 2 %stopped_push --nostringval-- --nostringval--
--nostringval-- false 1 %stopped_push 1 3 %oparray_pop
1 3 %oparray_pop 1 3 %oparray_pop 1 3 %oparray_pop
..runexec2 --nostringval-- --nostringval-- --nostringval-- 2
%stopped_push --nostringval-- 1 3 %oparray_pop --nostringval--
--nostringval-- --nostringval-- --dict:1/2(L)-- --nostringval--
1 %dict_continue
Dictionary stack:
--dict:1114/1686(ro)(G)-- --dict:0/20(G)-- --dict:102/200(L)--
Current allocation mode is local
Last OS error: 2
Current file position is 1968
ESP Ghostscript 815.01: Unrecoverable error, exit code 1



and file is:
$ cat -n file.ps
1 %!PS-Adobe-3.0
2 %%BeginProlog
3 /imStr 0 def /imageSrc {currentfile /ASCII85Decode filter
/RunLengthDecode filter imStr readstring pop } def
4 /BD {bind def} bind def
5 /D {def} BD
6 /C {curveto} BD
7 /L {lineto} BD
8 /M {moveto} BD
9 /R {grestore} BD
10 /G {gsave} BD
11 /N {newpath} BD
12 /P {closepath} BD
13 /EC {eoclip} BD
14 /WC {clip} BD
15 /EF {eofill} BD
16 /WF {fill} BD
17 /SG {setgray} BD
18 /SC {setrgbcolor} BD
19 /ISOF {
20 dup findfont dup length 1 add dict begin {
21 1 index /FID eq {pop pop} {D} ifelse
22 } forall /Encoding ISOLatin1Encoding D
23 currentdict end definefont
24 } BD
25 /NZ {dup 1 lt {pop 1} if} BD
26 /S {
27 moveto 1 index stringwidth pop NZ sub
28 1 index length 1 sub NZ div 0
29 3 2 roll ashow newpath} BD
30 /FL [
31 /AvantGarde-Book ISOF
32 /AvantGarde-BookOblique ISOF
33 /AvantGarde-Demi ISOF
34 /AvantGarde-DemiOblique ISOF
35 /Bookman-Demi ISOF
36 /Bookman-DemiItalic ISOF
37 /Bookman-Light ISOF
38 /Bookman-LightItalic ISOF
39 /Courier ISOF
40 /Courier-Bold ISOF
41 /Courier-BoldOblique ISOF
42 /Courier-Oblique ISOF
43 /Helvetica ISOF
44 /Helvetica-Bold ISOF
45 /Helvetica-BoldOblique ISOF
46 /Helvetica-Narrow ISOF
47 /Helvetica-Narrow-Bold ISOF
48 /Helvetica-Narrow-BoldOblique ISOF
49 /Helvetica-Narrow-Oblique ISOF
50 /Helvetica-Oblique ISOF
51 /NewCenturySchlbk-Bold ISOF
52 /NewCenturySchlbk-BoldItalic ISOF
53 /NewCenturySchlbk-Italic ISOF
54 /NewCenturySchlbk-Roman ISOF
55 /Palatino-Bold ISOF
56 /Palatino-BoldItalic ISOF
57 /Palatino-Italic ISOF
58 /Palatino-Roman ISOF
59 /Symbol findfont
60 /Times-Bold ISOF
61 /Times-BoldItalic ISOF
62 /Times-Italic ISOF
63 /Times-Roman ISOF
64 /ZapfDingbats findfont
65 /ZapfChancery-MediumItalic ISOF
66 ] D
67 /F {
68 FL exch get exch scalefont
69 [1 0 0 -1 0 0] makefont setfont} BD
70 %%EndProlog
71 %%BeginSetup
72 << /NumCopies 1 >> setpagedevice
73 %%EndSetup
74 %%Page: 1 1
75 << /PageSize [595.2755737304688 841.8897705078125] /ImagingBBox
null /ManualFeed false >> setpagedevice
76 /pgSave save def
77 841.8897705078125 0 exch translate 1 -1 scale[72 300 div 0 0 72
300 div 0 0]concat
78 G
79 [4.1666665 0.0 0.0 4.1666665 -0.0 -0.0] concat
80 N
81 72.0 72.0 M
82 523.276 72.0 L
83 523.276 769.89 L
84 72.0 769.89 L
85 72.0 72.0 L
86 P
87 WC
88 50.0 13 F
89 <4a61766120536f7572636520616e6420537570706f7274> 628.55994 0.0
274.75 S
90 pgSave restore
91 showpage
92 %%EOF

i commented the line 75, and gv can now draw it !!!

So i guess the all thing is a JVM postscript generation problem...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top