Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • 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!

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

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...I love the structure of the site. You start at the top, and drill down to what you want. Maybe I've been using Unix too long... :-) "

Geography

Where in the world do Tek-Tips members come from?
gowda111 (Programmer)
15 Sep 03 15:33
Hi,
Iam new to PCL. We want to create a packing slip using PCL in visual basic. Can you please tell what is needed to use PCL commands in Visual Basic. And if anyone has sample code for me to start with that will be great help.

Thanks
Kothi
JimBrown (IS/IT--Management)
19 Sep 03 3:07
Kothi,

Firstly, are you sure you should do it direct from VB without using a report writer?
 
But if you do want to do it straight from VB, here's some thoughts. You'll need to learn the PCL commands first.... somewhere in this board there's a url for electronic copies of the PCL manuals if you've not got them already. Once you figure out the commands you need, you need to create output strings in your VB code, to send to the printer. The escape code, which is part of each PCL command is Ascii character 27, so you need a Chr(27) in the strings at the appropriate point.

But here's the problem.... usually, when you use the printer object in VB to print with, it puts MORE PCL code round what you send (or PostScript, depending on the driver you use) and that messes the whole thing up.

So one of my colleagues found a reference at MicroSoft on how to do what they call Raw Printng, which is direct to the printer not thru' the driver. We experimented with it and it does work. Here's the url: http://support.microsoft.com/support/kb/articles/Q154/0/78.asp

In the VB code, you will see they create a string called sWrittenData which they send to the printer. If for example you make that string something like....

sWrittenData = Chr(27) & "(s4101T"

that would set the typeface to CG Times which is typeface number 4101. (The typeface command is esc(s#T where the # is the typeface number.)

You need to construct a whole lot of strings like that, each one with the commands to do what you want, and the text you want to print, of course.

HTH?


Jim Brown,
Johannesburg,
South Africa.
My time is GMT+2

jnebi (Programmer)
25 Sep 03 11:04
I have created an PCL/HPGL class (collection of methods & functions) in a 4gl called Progress that could be easily translated into VB, if you're interested. (jnebi@landam.com)
cbloom (Programmer)
15 Jul 05 17:47
Are you sure that you want to write pcl directly. vb6 has a printer object thats very easy to use and can print to any windows printer

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!

Back To Forum

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