×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

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!

*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

A few PCL questions

A few PCL questions

A few PCL questions

(OP)
I am writing an app to generate cheques from data files, I am new to PCL and it is confusing me a lot!

The things I need to know are:

How do I start/end a page?
How do I download and select a font (I only really need Arial)?
How can I print a multi-line text block?

I have managed to get some output but cannot seem to crack the above problems, all my multi-line text overprints itself on one line, multi-pages all overprint on the same page and everything is in courier and it's driving me mad, any help/advise would be greatly appreciated!

RE: A few PCL questions

1) End a page with either CHR$(12) i.e. FF or
chr$(27);"E" (reset)

Alternatively if using a windows printing program
there is an endpage for sending to the printer.

The Arial font can be closely approximated with
CHR$(27)+"(s4T"

(remember that multiple "commands" can be used in one
string with a CAPITAL letter signifying the end of the
command string)
i.e.
CHR$(27)+"(s0p10h12v0s0b4T"
would set a fixed font (0p) 10CPI (10h) 12 high upright (vs italic etc)->0s, normal (vs bold/light) ->0b and 4T is the typeface (52T should work as well on most printers).

Multi-line text block-- hmm well just print it would be
the first response. If you need to reformat it then make the changes and test it again.

print #15,"Now is the time for all good men"
print #15,"to come to the aid of their country."

If you need to print it at a specific location on the page
(remember you can move around in pcl).
Use
print #15,chr$(27)+"&a#r#H";"Text"
or
print #15,chr$(27)+"&a#v#H";"Text"
where # is the row number when using r, the horizontal or vertial position in 720ths of an inch when using h or v.

(assumes #15 opened to a printer port or as a file to be sent to the printer).

you can also use #C for column number but I discourage that.
Using #C is only closely consistent when using a fixed font
and even then can vary.

RE: A few PCL questions

(OP)
Thanks for the reply.

That solved most of the problems I had, the only problem I now have is the multi-line text.

I have switched on text wrapping which allows me to print multi-line but I need to print a name and address in a box on a pre-printed sheet, I can position it fine for the first line but each line after resets beack to the far left of the sheet, is there a way to make the next line start at the same position as the first?

RE: A few PCL questions

Certainly.

Use a PCL cursor positioning command immediately before the first character of each line. For example...

<esc>*p300XName
<esc>*p300XAddress
<esc>*p300XCity, State
<esc>*p300XZip

Substitute the 300 with the appropriate value for your needs. By default it is a 300 dpi address space which can be changed to other values with the "user units command", <esc>&u###D .

See the tech ref for allowable values.

Jim Asman

RE: A few PCL questions

or,
<esc>&a#r#Hnamegoeshere
<esc>&a#Haddresshere

assuming you want to print address on next line.

Now there is an alternative though like with the Column
PCL command I discourage it. But you can change the left margin multiple times.
i.e.
<esc>&#L
name
address
city
<esc>&#L
(to reset or set to a different left margin)
as with the column, it works best when the font is fixed.
That is it's most consistant from printer to printer.

RE: A few PCL questions

I'm not sure I typed it in correctly for the left margin
command syntax (it's part of the same group for horizontal/vertical positioning).

S/B
<esc>&a#L
or for basic
print #OuputDevice&,chr$(27);"&a";str$(number);"L"

where OuputDevice& is a number representing a file (stream)
or directly to printer.



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