Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Label Strings in PJL in PostScript 1

Status
Not open for further replies.

kgrafals

Programmer
Sep 25, 2006
6
US
I posted this problem with the postscript threads but it seems inappropriate there now that I've seen a section for PCL.

I've been trying to edit a postscript file to print "Released: <date>" (where <date> is today's date) on the corner of a page. I'm trying to use PJL and a LABELSTRING object to do it but when I send the PS file to the printer it prints out the code in what I'm sure is ASCII.

My PS code with PJL looks like this:

Code:
Ec%-12345X@PJL
@PJL JOB NAME="PostScript_04-28-06"
@PJL SET LABELSTRING="Released On: 04-28-06"
@PJL SET LABELLOCX = LEFT
@PJL SET LABELLOCY = BOTTOM
@PJL SET LABELSHADING = 75
@PJL SET LABELSIZE = 14
@PJL SET LABELROTATE = 0
@PJL SET LABELFONTOBJ = "HP2 Stick Font - Proportional"
@PJL ENTER LANGUAGE=AUTO
%!PS-Adobe-2.0
%%Creator: System Development PostScript Output Library
%%Copyright: System Development, Inc., All rights reserved
%%BoundingBox: 62 12 549 779
%%EndComments
%%BeginProlog
%%BeginProcSet: SDI_PS_Functions
/d{def}bind def/b{bind}bind d/bd{b d}b d/x{exch}bd/dp{dup}bd/al{aload}bd
/t{true}bd/f{false}bd/xd{x d}bd/r{roll}bd/c{copy}bd/i{index}bd/sb{sub}bd
/ad{add}bd/dv{div}bd/ng{neg}bd/p{pop}bd/rp{repeat}bd/lp{loop}bd/n{newpath}bd
/m{moveto}bd/l{lineto}bd/rl{rlineto}bd/cv{curveto}bd/a{arc}bd/an{arcn}bd

... postscript code ...

d /OV CV d } rp}bd/sstc{ /Sc //Svc d /Src //Srvc d nt cvr /OV xd 3{nt p}rp
 1 sb sst_ p p p}bd/sst{ /Sc //Scc d /Src //Srcc d nt cvr /OV xd 1 sb sst_
 p p p p p}bd/ssb{ /IX 0 d 3{nt p}rp 1 sb { nt nt nt sc IX bMn m 1 0 rl
 IX 1 ad bMx l -1 0 rl cp fl /IX IX 1 ad d }rp}bd
/Fc{gs 2 c tr Pm cc Pc Pr 8[Pc 0 0 Pr neg 0 Pr]{P} f 3 cli gr}bd
%%EndProcSet
%%EndProlog
%%BeginSetup
%%BeginFeature: *PageSize Letter
     << /PageSize [612 792] /MediaType null /InputAttributes << 0 << /PageSize [612 792] /MediaType null >> >> >>
     setpagedevice
%%EndFeature

n f ci 1 LT 1 et 1 lw 0 LC 0 LJ 1 ml 0 eLC 0 eLJ 1 eml 1 ew 0 0 0 lc 0 0
 0 ec 0 0 0 fc 0 0 0 tc 1 is f ev -1 1 wM 0 1 pM 0 -1 nM -1 1 bM f rct
0.18 0.18 scl
0.18 /fact x d
%%EndSetup
gs
0 0 0 lc
0 0 0 ec
0 0 0 fc
f ev
0 is
1 hi
/P1 <000000 >d
/Pc 1 d
/Pr 1 d
/P P1 d
1 LT
1 et
1 ew
1 lw
1 LT
1 lw
0 0 0 lc
0 0 0 tc
0 is
0 0 0 fc
1 hi
1 ew
1 et
0 0 0 ec
f ev
346.787 69.66 3053.214 4330.34 cr nc
t ci nc
2 LC
1 LT
2.456 lw
1 0 0 lc
0 LC
2257.973 2344.199 2227.276 2344.199 1 M
S
2917.945 2344.199 2856.552 2344.199 1 M
S
1567.303 2344.199 1628.696 2344.199 1 M
S
2534.24 2344.199 2273.321 2344.199 1 M
S

... more postscript ...

450.964 84.434 442.558 84.434 16 M
S
458.033 88.637 458.723 87.946 458.033 87.241 457.327 87.946 458.033 88.637
4 M
S
458.033 80.246 458.723 79.541 458.033 78.85 457.327 79.541 458.033 80.246
4 M
S
gr sp
%%EOF
@PJL EOJ
Ec%-12345X

Thanks,
Ken
 
Several points:

(a) You say "when I send the PS file to the printer it prints out the code in what I'm sure is ASCII".

What does it print? The PJL statements, or something else?

(b) When you refer to "Ec" at the start of your first sequence, you ARE alluding to the escape character (the unprintable character with hexadecimal code 1B (decimal code 27)) I assume.

(c) I've never seen the value AUTO used with the PJL Enter Language statement; this may be valid, but perhaps better, in the circumstances, to specify POSTSCRIPT instead.
 
Hi DansDad,

To answer your questions:
a. What I mean is that the printer prints the code as I see it in notepad and how it's written in my last post.
b. With the whole Ec thing, that's what I'm writing in notepad and I thought that writing Ec in notepad was the escape character. I've been printing this code with an HPGL printer and in my C code I use Ec for the escape character. Should I be using something else?
c. I didn't think AUTO was what I should be using but I've tried POSTSCRIPT and I get the same errors.

Thanks!
- ken
 
Point (b) "With the whole Ec thing, that's what I'm writing in notepad and I thought that writing Ec in notepad was the escape character. I've been printing this code with an HPGL printer and in my C code I use Ec for the escape character. Should I be using something else?" is at the root of your problem.

If the initial Universal Exit Language sequence (as represented at the start of your code snippet) does not start with a real escape character, then the printer will not switch into PJL mode and then subsequently into PostScript.

If you write Ec in NotePad, you'll get an upper-case letter "E", followed by a lower-case letter "c".

Ec (or Esc, <Esc>, <esc>, {Esc} ...) have all been used in documentation to represent the escape character, which (being a control-code character) has no direct printable form.

But these are all just 'representations', which actually mean "at this point insert an escape character control code".

The escape character control code is the character with decimal code 27 (equivalent to hexadecimal 1B, or octal 033).

I don't think that you can insert an escape character into a file using NotePad; you'd need to do it programmatically , or use a good hexadecinal editor (I use Hex Workshop from Breakpoint).
 
That's a huge help. I downloaded hex workshop, replaced all of the Ec's with 0x1B and I got my printer to print the drawing.

Still, the LabelString stuff doesn't work. I tried a "@PJL SET COPIES = 2" command and it did work so I know the it's reading PJL commands but it's not printing that label anywhere.

The code looks like this:
Code:
<Ec>%-12345X@PJL
@PJL JOB NAME="PostScript_04-28-06"
@PJL SET LABELSTRING="Released On: 04-28-06"
@PJL SET LABELLOCX = LEFT
@PJL SET LABELLOCY = BOTTOM
@PJL SET LABELSHADING = 75
@PJL SET LABELSIZE = 14
@PJL SET LABELROTATE = 0
@PJL SET LABELFONTOBJ = "HP2 Stick Font - Proportional"
@PJL ENTER LANGUAGE = POSTSCRIPT
%!PS-Adobe-2.0
%%Creator: System Development PostScript Output Library
...

Thanks,
- ken
 
Glad you got the printer to print your document.

I can't help you with LABELSTRING; I'm not that knowledgeable about PJL, so I've no idea just what setting this is supposed to do.

Note also that many PJL statements are printer-specific (i.e. only supported by one, or a small range of, printer(s)).
 
Is there another way (PJL or PCL) to print text on a page that wouldn't involve hacking a PS file?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top