×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Label Strings in PJL in PostScript

Label Strings in PJL in PostScript

Label Strings in PJL in PostScript

(OP)
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

RE: Label Strings in PJL in PostScript

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.

RE: Label Strings in PJL in PostScript

(OP)
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

RE: Label Strings in PJL in PostScript

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).

RE: Label Strings in PJL in PostScript

(OP)
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

RE: Label Strings in PJL in PostScript

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)).

RE: Label Strings in PJL in PostScript

(OP)
Is there another way (PJL or PCL) to print text on a page that wouldn't involve hacking a PS file?

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close